Adding actionListener to JComboBox

Hi there
I have added actionListener to a JComboBox. I only want the actionPerformed() get called when the user choose the item in the JComboBox, however, it also get called whenever I change the items in the JComboBox.
I have tried to call the ActionEvent.getID() method to identify the action, however, changing the items and choosing the item give me the same ID - 1001.
Has anyone got this problem before? How did you solve it?
Should I use other Listener for listening only the choosing event?
In advance thanks!
From
Edmond

I had many problems using actionListeners with JComboBox because it gets called all the time, I have had much better luck using mouseListener and the events getClickCount() method for single and double click selections, this avoided many of the problems for me.

Similar Messages

  • ActionListener for JComboBox

    If I add an ActionListener to JComboBox or ComboBoxEditor I can get notified when user types some text into the combo-box and presses enter.
    If I need to get notifications after user types each letter. What should I do ?
    I'm stuck with this problem for a long time (I'm a beginner) - any help would be greatly appreciated. Thanks a lot,
    --Sergei 

    This would be my solution. There may be more but, this is the mest i can do;)
    So adding KeyListener.
    Let "cb" be your JComboBox object name, what you have to do is:
    cb.setEditable(true);
    ComboBoxEditor ce = cb.getEditor();
    ce.getEditorComponent().addKeyListener(this);
    here is the entire example. This progtram will count your keyevents
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Example extends Frame implements KeyListener
         private JComboBox cb = new JComboBox();
         private JLabel lab = new JLabel(" ");
         int numb = 0;
         public Example()
              cb.setEditable(true);
              ComboBoxEditor ce = cb.getEditor();
              ce.getEditorComponent().addKeyListener(this);
              setLayout(new FlowLayout());
              add(cb);
              add(lab);
              setSize(200,200);
              show();
         public static void main(String args[])
              new Example();          
         public void keyPressed(KeyEvent e)
         public void keyReleased(KeyEvent e)
                   numb ++;
                   lab.setText(Integer.toString(numb));
         public void keyTyped(KeyEvent e)

  • Adding items in JComboBox - Help

    Hy, I have a JComboBox() and a JTextField().
    when I input a name in the JTextField and clicks on the "Ok" button
    the name is added in the JComboBox().
    What I want is when I click on the "Ok" button, a check is made to see
    whether the name input in the JTextField already exist in the JComboBox().
    If is exist a message is displayed else it is added.
    How to perform the check.
    PLease send me code for doing this.
    thanks

    Hi.
    The JComboBox uses a model to get its hands on the elements to be displayed. Thus you must search the model to see if the string is already contained.
    Use something like this:
        public boolean contains(JComboBox comboBox, String s) {
            int elementCount = comboBox.getModel().getSize();
            for (int i = 0; i < elementCount; i ++) {
                String t = (String)comboBox.getModel().getElementAt(i);
                if (t.equals(s))
                    return true;
            return false;
        }Hope this helps,
    Michael

  • Added actionListener, then GUI broke

    Hi,
    1. first i ran my menu GUI, it worked fine
    2. then i added the actionListener code... now she no workie...
    what did i do wrong???
    ERROR MSG:
    C:\jLotto\LotFrame.java:34: cannot resolve symbol
    symbol : class ActionListener
    location: class LottoFrame
              new ActionListener(){
    ^
    1 error
    Tool completed with exit code 1
    import javax.swing.JFrame;
    import javax.swing.JMenuBar;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.KeyStroke;
    import java.awt.Event;
    import javax.swing.JOptionPane; //print menu trial run
    public class LotFrame extends JFrame
      // Constructor
      public LotFrame(String title)
        setTitle(title);                             // Set the window title
        setDefaultCloseOperation(EXIT_ON_CLOSE);     // handle exit operation
        setJMenuBar(menuBar);                        // Add the menu bar to the window
        //MAIN MENU
        JMenu fileMenu    = new JMenu("File");          // Create File menu
        JMenu findMenu    = new JMenu("Find");
        // Construct the file pull down menu
        newItem   = fileMenu.add("New");             // Add New item
        openItem  = fileMenu.add("Open");            // Add Open item
        closeItem = fileMenu.add("Close");           // Add Close item
        fileMenu.addSeparator();                      // Add separator
        saveItem  = fileMenu.add("Save");            // Add Save item
        saveAsItem= fileMenu.add("Save As...");      // Add Save As item
        fileMenu.addSeparator();                      // Add separator
        printItem.addActionListener(
               new ActionListener(){
                    public void actionPerformed( ActionEvent e )
                         JOptionPane.showMessageDialog( LotFrame.this,
                         "adding actionListener at end of GUI setup",
                         "action at end", JOptionPane.PLAIN_MESSAGE);
                    }//end of actionPerformed
              }//end of actionLinstener
         );//endof .addActionListener
       printItem = fileMenu.add("Print");           // Add Print item
        menuBar.add(fileMenu);                       // Add the file menu
        menuBar.add(findMenu);
      }//end of constructor
      private JMenuBar menuBar = new JMenuBar();     // Window menu bar
      // File menu items
      private JMenuItem newItem, openItem, closeItem, saveItem, saveAsItem, printItem;
    }//end of class LotFrame

    java.awt.event.*;
    import java.awt.Event;

  • Adding actionlistener to JTextArea

    I'm trying to add an actionListener to my JTextArea, so that when the user hits 'enter', the action occurs.
    sort of like this:
    JTextArea.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ??????) {
    doSomethingToTextArea();
    but I'm having problems (e.g. how to make enter the action event, and some problem that says JTextArea can't use actionlisteners???)
    any ideas?
    thanks,
    n00bProgrammer

    Like serveral of the more complex swing gadgets the JTextarea uses model/view architecture. In this case the model behind the textarea is a Document, and the text change listener needs to be added to the Document, not the gadget itself. i.e. area.getModel().addDocumentListener();
    However JTextArea still inherits the methods of java.awt.Component including addKeyListener();

  • Adding actionlistener to menuItem

    hi...i'm trying to add an actionListener to a menuItem. i looked at the tutorial on "how to use menus" but i cant seem to execute the menuitem. here's my code...
    public class Controller implements ActionListener
        GUI gui;
        public Controller(GUI g)
            gui = g;
            gui.menuItem.addActionListener(this);
        public void actionPerformed(ActionEvent e)
            gui.menuItem = (JMenuItem)(e.getSource());
            if (gui.menuItem.getText().equals("New Database"))
                System.out.println("Hello");
    }where the class GUI is where the menItems have been added to the menus. i'm just trying out for one menuItem first but i wont get the "hello" printed on the screen...can someone give me some assistance on this given that i havent used JMenuItems before...thx in advance...

    As carnickr said we really need the source from GUI to be able to help you more. Even without looking at GUI it's apparent that you're methodology is lacking. Depending on design and requirements I can think of many different ways you might need to handle menu item actions. I can't think of a single one that would involve comparing the text, which is what you're doing.
    First of all, adding a listener to a public field of a different class is inherently the product of a flawed design or bad design itself. Your code should look more like this:
    JMenuItem newDatabase = new JMenuItem("New Database");
    JMenuItem openDatabase = new JMenuItem("Open Database");
    JMenuItem closeDatabase = new JMenuItem("Close Database");
    ActionListener listener = new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              if (e.getSource() == newDatabase) {
                   System.out.println("New database clicked");
              } else if (e.getSource() == openDatabase) {
                   System.out.println("Open database clicked");
              } else fi (e.getSource() == closeDatabase) {
                   System.out.println("Close database clicked");
    newDatabase.addActionListener(listener);
    openDatabase.addActionListener(listener);
    closeDatabase.addActionListener(listener);Obviously an anonymous class is not always appropriate. The important thing here is that you're comparing the reference to see if it's the same Object, not trying to compare the text. If you post GUI and a little more about what you're trying to do we can try and give you some pointers on how to design it better.

  • Adding ActionListener to JMenu

    Is it possible to add actionListener to Jmenu object
    for example File, Format, Exit these are Menus added in the menuBar not menu items
    on clicking the Exit the frame shuld get closed.
    For detecting the action clicked on the Menu shall i use actionListener?
    I have tried using MenuListener its getting invoked on selection
    I dont want it on selection , I want the frame to be displayed only on clicking that menu.

    Alas, whilst a JMenu is-a JMenuItem (the Composite Pattern at work), it doesn't function entriely like on,
    and registering ActionListeners with a JMenu doesn't work. Try MenuListener:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class ActionExample {
        public static void main(String[] args) {
            Action sample = new SampleAction();
            JMenu menu = new JMenu("Menu");
            menu.setMnemonic(KeyEvent.VK_M);
            menu.add(sample);
            menu.addMenuListener(new SampleMenuListener());
            JToolBar tb = new JToolBar();
            tb.add(sample);
            JTextField field = new JTextField(10);
            field.setAction(sample);
            JFrame f = new JFrame("ActionExample");
            JMenuBar mb = new JMenuBar();
            mb.add(menu);
            f.setJMenuBar(mb);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(tb, BorderLayout.NORTH);
            f.getContentPane().add(field, BorderLayout.SOUTH);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    class SampleMenuListener implements MenuListener {
        public void menuSelected(MenuEvent e) {
            System.out.println("menuSelected");
        public void menuDeselected(MenuEvent e) {
            System.out.println("menuDeelected");
        public void menuCanceled(MenuEvent e) {
            System.out.println("menuCanceled");
    class SampleAction extends AbstractAction {
        public SampleAction() {
            super("Sample");
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt S"));
            putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
            putValue(SHORT_DESCRIPTION, "Just a sample action");
        public void actionPerformed(ActionEvent evt) {
            System.out.println("sample...");
    }

  • Actionlistener for JCombobox with JCheckbox

    Hi!
    I have written a JComboBox item which holds a checkbox :
    public class CheckComboItem extends JCheckBox{
        private static final long serialVersionUID = 1677961185556377734L;
        public Integer id = 0;
        public CheckComboItem(Integer id, String text, Boolean state) {
            super(text, state);
            this.id = id;
    }This works fine; However i have problems with my action listener, which should change the checkbox' selection state.
    Unfortunately this only works sometimes (randomly) :-(
    public class CheckComboListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox) e.getSource();
            CheckComboItem store = (CheckComboItem) cb.getSelectedItem();
            store.setSelected((!store.isSelected()));
    }Can you please tell me what i am doing wrong/ how this needs to be improved ?
    Thank you very much!

    You managed to find the Swing forum the last time you posted a Swing question.
    Why didn't you search the Swing forum this time before you posted a question?
    Maybe a JCheckBoxMenuItem will work better.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.

  • Adding actionListener to a button

    pls i want to create an applet with buttons rectangle,circle,and polygon and having a textArea.when someone clicks on the rectangle buttons it draws a rectangle,on the circle buttons it draws a circle and on the polygon button it draws a polygon.pls i have already created the user interface how do i add the actionListeners to the respective buttons and reggister them.

    Hi,
    try something like this:
    JButton jButton1 = new JButton("yourbutton");
    jButton1.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                    someMethodThatDoesWhatYouNeed();
    });this is just a way to do it, there are other ways, just look around in the forum to discover them.
    JoY?TiCk

  • Adding ActionListener to JPanel or equivalent

    Hi all.
    I am trying to add an actionListener for mouse clicks on a JPanel, ideally using something like this:
    panel.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e)
              //do something
       });However, JPanel does not implement addActionListener, and as far as I can see the only components which do are buttons, radio buttons and the like.
    I tried extending JPanel to implement ActionListener, but had no success.
    Is there an easy way to monitor for mouse clicks on a JPanel or container? Bearing in mind there will be several of these containers at different locations, so using a global mouse listener would not be useful.
    Thanks

    Hi all.
    I am trying to add an actionListener for mouse clicks
    on a JPanel, ideally using something like this:
    panel.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e)
    //do something
    });owever, JPanel does not implement addActionListener,
    and as far as I can see the only components which do
    are buttons, radio buttons and the like.
    I tried extending JPanel to implement ActionListener,
    but had no success.
    Is there an easy way to monitor for mouse clicks on a
    JPanel or container? Use a MouseListener.
    Bearing in mind there will be
    several of these containers at different locations,
    so using a global mouse listener would not be
    useful.So add individual MouseListeners to each container.
    >
    Thanks

  • Adding actionListener to JOptionPane

    how do you add an actionListener to a JOptionPane?
    im using JOptionPane.showMessageDialog, and i want an event to happen when the user clicks on the "Okay" button

    Can you do something like this instead? Use a showConfirmDialog(...) istead of the showMessageDialog(...), then use the return value to determine which button the user pushed?
    int retValue = JOptionPane.showConfirmDialog(parent, message, Title, JOptionPane.OK_CANCEL_OPTION );
    if (retValue == JOptionPane.OK_OPTION)
      doOkayEvent();
    else
      doNotOkayEvent();

  • Trouble adding actionlistener to a panel in a tabbed pane

    Hi, please help me! this is the code i wrote, with the error given below:
    CODE:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class tabslisten extends JApplet
         JPanel RecPanel;
         GridBagLayout gbl;
         GridBagConstraints gbc;
         public void init ()
              FlowLayout flow;
              flow = new FlowLayout();     
              Container content = getContentPane();
              content.setLayout(new GridLayout());
              JTabbedPane tabpane = new JTabbedPane();
              content.add(tabpane, flow);
              RecPanel = new JPanel();
              recipientDetails();
              tabpane.addTab("Recipient Details", null, RecPanel, "Recipient Details");     
         public void recipientDetails()
              JLabel lblRecFName;
              JLabel lblRecLName;
              JTextField txtRecFName;
              JTextField txtRecLName;
              JButton btnValidate;
              gbl = new GridBagLayout();
              gbc = new GridBagConstraints();
              RecPanel.setLayout(gbl);
              lblRecFName = new JLabel("First Name");
              lblRecLName = new JLabel("Last Name");
              txtRecFName = new JTextField(8);
              txtRecLName = new JTextField(5);
              btnValidate= new JButton("Validate");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 8;
              gbl.setConstraints(lblRecFName, gbc);
              RecPanel.add(lblRecFName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 4;
              gbc.gridy = 8;
              gbl.setConstraints(txtRecFName, gbc);
              RecPanel.add(txtRecFName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 11;
              gbl.setConstraints(lblRecLName, gbc);
              RecPanel.add(lblRecLName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 4;
              gbc.gridy = 11;
              gbl.setConstraints(txtRecLName, gbc);
              RecPanel.add(txtRecLName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 4;
              gbc.gridy = 32;
              gbl.setConstraints(btnValidate, gbc);
              RecPanel.add(btnValidate);
              validateAction validateButton = new validateAction();
              btnValidate.addActionListener(validateButton);
         class validateAction implements ActionListener
              public void actionPerformed(ActionEvent evt)
                   Object obj = evt.getSource();
                   if (obj == btnValidate)
                        String fName = txtRecFName.getText();
                        String lName = txtRecLName.getText();
                        if (fName.length()==0)
                             getAppletContext().showStatus("First Name not entered.");
                             return;
                        else if (lName.length()==0)
                             getAppletContext().showStatus("Last Name not entered.");
                             return;
                        else
                             getAppletContext().showStatus("Successful.");
    ERROR:
    tabslisten.java:90: Undefined variable: btnValidate
    if (obj == btnValidate)
    ^
    tabslisten.java:92: Undefined variable or class name: txtRecFName
    String fName = txtRecFName.getText();
    ^
    tabslisten.java:93: Undefined variable or class name: txtRecLName
    String lName = txtRecLName.getText();
    ^
    3 errors
    Press any key to continue...
    I'm sure I'm doing something really stupid, but I don't know what! ANY and ALL help will be appreciated! Thanks!

    I copied your program and ran it. It works fine. Make sure the three variables you made class variables are only defined in one place. (ie you moved them not copied them). Other than that I have no ideas.
    With regards to naming conventions. My only comment is, take a look at the Java API.
    1) classes have uppercased words. Examples from your program - JTextField, Container, FlowLayout, GridLayout...
    2) methods and variable names don't upper case the first word - getContentPane(), setLayout()...
    Here is the program that works for me:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class FirstApplet extends JApplet
         JPanel RecPanel;
         GridBagLayout gbl;
         GridBagConstraints gbc;
         JTextField txtRecFName;
         JTextField txtRecLName;
         JButton btnValidate;
         public void init ()
              System.out.println("hello there");
              FlowLayout flow;
              flow = new FlowLayout();
              Container content = getContentPane();
              content.setLayout(new GridLayout());
              JTabbedPane tabpane = new JTabbedPane();
              content.add(tabpane, flow);
              RecPanel = new JPanel();
              recipientDetails();
              tabpane.addTab("Recipient Details", null, RecPanel, "Recipient Details");
         public void recipientDetails()
              JLabel lblRecFName;
              JLabel lblRecLName;
              gbl = new GridBagLayout();
              gbc = new GridBagConstraints();
              RecPanel.setLayout(gbl);
              lblRecFName = new JLabel("First Name");
              lblRecLName = new JLabel("Last Name");
              txtRecFName = new JTextField(8);
              txtRecLName = new JTextField(5);
              btnValidate= new JButton("Validate");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 8;
              gbl.setConstraints(lblRecFName, gbc);
              RecPanel.add(lblRecFName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 4;
              gbc.gridy = 8;
              gbl.setConstraints(txtRecFName, gbc);
              RecPanel.add(txtRecFName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 1;
              gbc.gridy = 11;
              gbl.setConstraints(lblRecLName, gbc);
              RecPanel.add(lblRecLName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 4;
              gbc.gridy = 11;
              gbl.setConstraints(txtRecLName, gbc);
              RecPanel.add(txtRecLName);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 4;
              gbc.gridy = 32;
              gbl.setConstraints(btnValidate, gbc);
              RecPanel.add(btnValidate);
              validateAction validateButton = new validateAction();
              btnValidate.addActionListener(validateButton);
         class validateAction implements ActionListener
              public void actionPerformed(ActionEvent evt)
                   Object obj = evt.getSource();
                   if (obj == btnValidate)
                        String fName = txtRecFName.getText();
                        String lName = txtRecLName.getText();
                        if (fName.length()==0)
                             getAppletContext().showStatus("First Name not entered.");
                             return;
                        else if (lName.length()==0)
                             getAppletContext().showStatus("Last Name not entered.");
                             return;
                        else
                             getAppletContext().showStatus("Successful.");

  • Adding Actionlistener to a cell in a JTable?

    is this possible? how would i go among doing this?

    use the ListSelectionListener.
    In "valueChanged(ListSelectionEvent e)" you get the row with "e.getFirstIndex()".

  • JTable with JComboBox

    Hi friends,
    I am adding JComboBox in JTable its working properly
    But data is not adding dynamically to JComboBox
    I am Sending my Code plz give me reply
    I am Struggleing from 1 week on wards
    package com.dnt.autopopulation;
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableColumn;
    import java.awt.event.*;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.event.TableModelEvent;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.Locale;
    import java.text.SimpleDateFormat;
    import java.util.Vector;
    import javax.swing.border.*;
    import com.dnt.eaip.Connectmagr;
    import com.dnt.eaip.*;
    import com.dnt.util.*;
    import javax.swing.plaf.ButtonUI;
    import com.dnt.admin.EndStartDateCheck;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumnModel;
    public class AutoPopRollBack extends JPanel {
    boolean selection = false;
    public static final int HAND_CURSOR = 12;
    Cursor cursor = new Cursor(HAND_CURSOR);
    int selectedRow = -1;
    ImageIcon headertop1 = new ImageIcon("./images/k2topbar.gif");
    JLabel HeaderLabe = new JLabel(headertop1);
    Border border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, Color.blue);
    Border border2 = BorderFactory.createBevelBorder(BevelBorder.RAISED,
    new Color(154, 254, 211), new Color(108, 178, 148),
    new Color(37, 60, 50), new Color(53, 87, 72));
    DefaultTableModel dm = new DefaultTableModel();
    Vector searchlist = new Vector();
    Vector rows = new Vector();
    Vector returnList;
    Connectmagr objConnectmagr = new Connectmagr();
    JFrame frame = new JFrame();
    JLabel headlab = new JLabel();
    JCalendarComboBox EndDateTxt;
    JLabel HawbLab = new JLabel();
    JTextField HawbTxt = new JTextField();
    JLabel AgentLab = new JLabel();
    JLabel StartDateLab = new JLabel();
    JCalendarComboBox StartDateTxt;
    JComboBox AgentLBox = new JComboBox();
    JLabel EnddateLab = new JLabel();
    JPanel ReviewJobsPane = new JPanel();
    JButton SearchBtn = new JButton();
    ButtonUI ui = new com.sun.java.swing.plaf.motif.MotifButtonUI();
    ArrayList AgentList = new ArrayList();
    JComboBox DocTypeLBox = new JComboBox();
    JLabel doctypelab = new JLabel();
    JPanel displayPanel = new JPanel();
    ButtonGroup group1;
    JRadioButton rb;
    JTable table;
    public ArrayList jobList = new ArrayList();
    public AutoPopRollBack(JFrame frame, ArrayList agentArrayList) {
    this.frame = frame;
    this.AgentList = agentArrayList;
    try {
    jbInit();
    } catch (Exception e) {
    e.printStackTrace();
    public void jbInit() throws Exception {
    Calendar cal = Calendar.getInstance();
    Locale loc = new Locale("");
    SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy");
    EndDateTxt = new JCalendarComboBox(cal, loc, dateformat);
    StartDateTxt = new JCalendarComboBox(cal, loc, dateformat);
    HeaderLabe.setBackground(new Color(250, 233, 216));
    HeaderLabe.setBounds(new Rectangle(0, 0, 830, 33));
    this.setLayout(null);
    this.setBackground(SystemColor.control);
    headlab.setBackground(new Color(250, 233, 216));
    headlab.setFont(new java.awt.Font("Verdana", 1, 12));
    headlab.setForeground(Color.blue);
    headlab.setHorizontalAlignment(SwingConstants.CENTER);
    headlab.setText(" :: Auto Population Rollback");
    headlab.setBounds(new Rectangle(39, 2, 247, 25));
    EndDateTxt.setBounds(new Rectangle(474, 36, 116, 18));
    EndDateTxt.setBackground(Color.white);
    EndDateTxt.setFont(new java.awt.Font("Times New Roman", 1, 10));
    EndDateTxt.setForeground(Color.blue);
    EndDateTxt.setBorder(null);
    HawbLab.setFont(new java.awt.Font("Dialog", 0, 13));
    HawbLab.setForeground(Color.blue);
    HawbLab.setHorizontalAlignment(SwingConstants.RIGHT);
    HawbLab.setText("Job No/Airway Bill No:");
    HawbLab.setBounds(new Rectangle(326, 14, 146, 18));
    HawbTxt.setBounds(new Rectangle(474, 14, 125, 18));
    HawbTxt.setText("");
    HawbTxt.setFont(new java.awt.Font("Times New Roman", 1, 10));
    HawbTxt.setForeground(Color.blue);
    HawbTxt.setBorder(border1);
    AgentLab.setFont(new java.awt.Font("Dialog", 0, 13));
    AgentLab.setForeground(Color.blue);
    AgentLab.setHorizontalAlignment(SwingConstants.RIGHT);
    AgentLab.setText("<html>Agent:<font size=\'4\' color=\"#993333\">*</font></html>");
    AgentLab.setBounds(new Rectangle(31, 14, 97, 18));
    StartDateLab.setFont(new java.awt.Font("Dialog", 0, 13));
    StartDateLab.setForeground(Color.blue);
    StartDateLab.setHorizontalAlignment(SwingConstants.RIGHT);
    StartDateLab.setText("Start Date:");
    StartDateLab.setBounds(new Rectangle(23, 36, 105, 18));
    StartDateTxt.setBounds(new Rectangle(129, 36, 116, 18));
    StartDateTxt.setBackground(Color.white);
    StartDateTxt.setFont(new java.awt.Font("Times New Roman", 1, 10));
    StartDateTxt.setForeground(Color.blue);
    StartDateTxt.setBorder(null);
    AgentLBox.setBackground(Color.white);
    AgentLBox.setFont(new java.awt.Font("Verdana", 0, 13));
    AgentLBox.setForeground(Color.blue);
    AgentLBox.setBounds(new Rectangle(129, 14, 178, 18));
    AgentLBox.setFont(new java.awt.Font("Times New Roman", 1, 10));
    EnddateLab.setFont(new java.awt.Font("Dialog", 0, 13));
    EnddateLab.setForeground(Color.blue);
    EnddateLab.setHorizontalAlignment(SwingConstants.RIGHT);
    EnddateLab.setText("End Date:");
    EnddateLab.setBounds(new Rectangle(391, 36, 81, 18));
    ReviewJobsPane.setBackground(new Color(240, 233, 216));
    ReviewJobsPane.setBorder(BorderFactory.createLineBorder(Color.black));
    ReviewJobsPane.setBounds(new Rectangle(69, 47, 705, 96));
    ReviewJobsPane.setLayout(null);
    SearchBtn.setUI(ui);
    SearchBtn.setCursor(cursor);
    SearchBtn.setBackground(new Color(76, 125, 104));
    SearchBtn.setBounds(new Rectangle(377, 153, 89, 19));
    SearchBtn.setFont(new java.awt.Font("Tahoma", 1, 10));
    SearchBtn.setForeground(Color.white);
    SearchBtn.setBorder(border2);
    SearchBtn.setOpaque(true);
    SearchBtn.setFocusPainted(false);
    SearchBtn.setText("Search");
    SearchBtn.addActionListener(new AutoPopRollBack_SearchBtn_actionAdapter(this));
    for (int i = 0; i < AgentList.size(); i++)
    AgentLBox.addItem( (String) AgentList.get(i));
    DocTypeLBox.setFont(new java.awt.Font("Verdana", 0, 13));
    DocTypeLBox.setForeground(Color.blue);
    DocTypeLBox.setMinimumSize(new Dimension(22, 19));
    DocTypeLBox.setBounds(new Rectangle(129, 58, 179, 18));
    DocTypeLBox.setFont(new java.awt.Font("Times New Roman", 1, 10));
    DocTypeLBox.addItem("New Jobs");
    DocTypeLBox.addItem("Draft jobs");
    DocTypeLBox.addItem("Finished jobs");
    doctypelab.setBounds(new Rectangle(7, 58, 121, 18));
    doctypelab.setText("<html>Document Type:<font size=\'4\' color=\"#993333\">*</font></html>");
    doctypelab.setHorizontalAlignment(SwingConstants.RIGHT);
    doctypelab.setForeground(Color.blue);
    doctypelab.setFont(new java.awt.Font("Dialog", 0, 13));
    displayPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    displayPanel.setBounds(new Rectangle(69, 182, 705, 315));
    this.add(headlab, null);
    this.add(HeaderLabe, null);
    this.add(ReviewJobsPane, null);
    ReviewJobsPane.add(HawbLab, null);
    ReviewJobsPane.add(AgentLab, null);
    ReviewJobsPane.add(AgentLBox, null);
    ReviewJobsPane.add(StartDateLab, null);
    ReviewJobsPane.add(StartDateTxt, null);
    ReviewJobsPane.add(HawbTxt, null);
    ReviewJobsPane.add(EnddateLab, null);
    ReviewJobsPane.add(EndDateTxt, null);
    ReviewJobsPane.add(DocTypeLBox, null);
    ReviewJobsPane.add(doctypelab, null);
    this.add(SearchBtn, null);
    this.add(displayPanel, null);
    //this.add(scrollPaneView, null);
    // scrollPaneView.getViewport().add(displayPanel, null);
    this.setVisible(true);
    void FieldEditable(boolean str) {
    StartDateTxt.setEnabled(str);
    EndDateTxt.setEnabled(str);
    public static void main(String args[]) {
    JFrame frame = new JFrame();
    ArrayList agentlist = new ArrayList();
    agentlist.add(0, "BF0651");
    agentlist.add(1, "PF0010");
    AutoPopRollBack objAutoPopRollBack = new AutoPopRollBack(frame, agentlist);
    frame.getContentPane().add(objAutoPopRollBack);
    frame.setBounds(new Rectangle(0, 0, 820, 593));
    frame.setVisible(true);
    void SearchBtn_actionPerformed(ActionEvent e) {
    displayPanel.setVisible(false);
    Vector data=new Vector();
    rows.removeAllElements();
    boolean flag = true;
    String che = new EndStartDateCheck().crossCheck(StartDateTxt.getCalendar(), EndDateTxt.getCalendar());
    try {
    if(HawbTxt.getText().equalsIgnoreCase("")){
    if (StartDateTxt._spinner.getText().equalsIgnoreCase("")) {
    JOptionPane.showMessageDialog(this, "Please Select Start Date",
    "Warning", JOptionPane.WARNING_MESSAGE);
    flag = false;
    else if (!che.equalsIgnoreCase("")) {
    JOptionPane.showMessageDialog(frame, che, "Message Window", JOptionPane.INFORMATION_MESSAGE);
    flag = false;
    }else{
    FieldEditable(true);
    if (flag) {
    try {
    displayPanel.removeAll();
    } catch (Exception ex) {
    rows.removeAllElements();
    data.removeAllElements();
    SearchBtn.setEnabled(true);
    searchlist.add(0, AgentLBox.getSelectedItem().toString().trim());
    if (!HawbTxt.getText().trim().equalsIgnoreCase(""))
    searchlist.add(1, HawbTxt.getText().toString().trim());
    else
    searchlist.add(1, "");
    searchlist.add(2, new Integer(DocTypeLBox.getSelectedIndex() + 1));
    String startDate = new ConvertDate().convertddMM_To_MMdd(StartDateTxt._spinner.getText());
    String endDate = new ConvertDate().convertddMM_To_MMdd(EndDateTxt._spinner.getText());
    Vector columns = new Vector();
    columns.add(0, "");
    columns.add(1, "JOB No");
    columns.add(2, "Status");
    columns.add(3, "Current Form Type");
    columns.add(4, "New Form Type");
    System.out.println("Before calling Data Base");
    jobList = objConnectmagr.AutoRollBackSearch(searchlist, startDate, endDate, "AutoPopRollBack");
    if (jobList.size() > 0) {
    for (int i = 0; i < jobList.size(); i++) {
    ArrayList temp = new ArrayList();
    temp = (ArrayList) jobList.get(i);
    Vector col = new Vector();
    col.add(0, new Boolean(false));
    col.add(1, temp.get(0).toString().trim());
    col.add(2, temp.get(1).toString().trim());
    col.add(3, temp.get(2).toString().trim());
    Vector tempstr=new Vector();
    String [] tem=temp.get(3).toString().trim().split("\\|");
    tempstr.removeAllElements();
    for(int k=0;k<tem.length;k++)
    tempstr.add(k,tem[k]);
    col.add(4, new JComboBox(tempstr));
    data.add(col);
    dm.setDataVector(data, columns);
    table = new JTable(dm) {
    public void tableChanged(TableModelEvent e) {
    super.tableChanged(e);
    public boolean isCellEditable(int rowIndex, int vColIndex) {
    return true;
    JScrollPane scroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(false);
    table.setCellSelectionEnabled(false);
    table.setBackground(SystemColor.inactiveCaptionText);
    table.setRowHeight(20);
    JTableHeader head = table.getTableHeader();
    head.setSize(850, 75);
    table.setTableHeader(head);
    table.getTableHeader().setFont(new Font("Verdana", Font.BOLD, 11));
    table.getTableHeader().setBackground(new Color(130, 170, 150));
    table.getTableHeader().setForeground(Color.BLUE);
    table.getTableHeader().setReorderingAllowed(false);
    table.getTableHeader().setResizingAllowed(false);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setFont(new java.awt.Font("MS Sans Serif", 0, 13));
    table.setForeground(new Color(125, 25, 0));
    TableColumn col = table.getColumnModel().getColumn(0);
    col.setMinWidth(75);
    col.setMaxWidth(75);
    TableColumn col1 = table.getColumnModel().getColumn(1);
    col1.setMinWidth(150);
    col1.setMaxWidth(150);
    TableColumn col2 = table.getColumnModel().getColumn(2);
    col2.setMinWidth(150);
    col2.setMaxWidth(150);
    TableColumn col3 = table.getColumnModel().getColumn(3);
    col3.setMinWidth(150);
    col3.setMaxWidth(150);
    TableColumn col4 = table.getColumnModel().getColumn(4);
    col4.setMinWidth(160);
    col4.setMaxWidth(160);
    TableColumn tc = table.getColumnModel().getColumn(0);
    tc.setCellEditor(table.getDefaultEditor(Boolean.class));
    tc.setCellRenderer(table.getDefaultRenderer(Boolean.class));
    tc.setHeaderRenderer(new CheckBoxHeader(new MyItemListener()));
    Vector tempstr=new Vector();
    for(int j=0;j<jobList.size();j++){
    ArrayList temlist=(ArrayList)jobList.get(j);
    String [] tem=temlist.get(3).toString().trim().split("\\|");
    tempstr.removeAllElements();
    for(int k=0;k<tem.length;k++)
    tempstr.add(k,tem[k]);
    JComboBox portTypesCombo = new JComboBox(tempstr);
    col4.setCellEditor(new DefaultCellEditor(portTypesCombo));
    col4 = table.getColumnModel().getColumn(4);
    col4.setCellEditor(new MyComboBoxEditor(tempstr));
    // If the cell should appear like a combobox in its
    // non-editing state, also set the combobox renderer
    col4.setCellRenderer(new MyComboBoxRenderer(tempstr));
    System.out.println(tempstr);
    displayPanel.setLayout(new BorderLayout());
    displayPanel.add(table.getTableHeader(), BorderLayout.PAGE_START);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    table.setEditingColumn(0);
    int column = 0;
    if (e.getClickCount() == 1) {
    Point p = e.getPoint();
    selectedRow = table.rowAtPoint(p);
    column = table.columnAtPoint(p);
    System.out.println(table.isCellEditable(selectedRow, column));
    if (column != 0) {
    selectedRow = -1;
    returnList = new Vector();
    returnList = (Vector) rows.get(selectedRow);
    else if (column == 0) {
    table.revalidate();
    table.repaint();
    scroll.getViewport().add(table);
    displayPanel.add(scroll, BorderLayout.CENTER);
    displayPanel.setVisible(true);
    else {
    JOptionPane.showMessageDialog(this, "No Data Available");
    } catch (Exception e1) {
    e1.printStackTrace();
    class MyItemListener implements ItemListener {
    public void itemStateChanged(ItemEvent e) {
    Object source = e.getSource();
    if (source instanceof AbstractButton == false)return;
    boolean checked = e.getStateChange() == ItemEvent.SELECTED;
    for (int x = 0, y = table.getRowCount(); x < y; x++) {
    table.setValueAt(new Boolean(checked), x, 0);
    class AutoPopRollBack_SearchBtn_actionAdapter implements java.awt.event.ActionListener {
    AutoPopRollBack adaptee;
    AutoPopRollBack_SearchBtn_actionAdapter(AutoPopRollBack adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.SearchBtn_actionPerformed(e);
    class RadioButtonRenderer implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (value == null)return null;
    return (Component) value;
    class RadioButtonEditor extends DefaultCellEditor implements ItemListener {
    private JRadioButton button;
    public RadioButtonEditor(JCheckBox checkBox) {
    super(checkBox);
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int row,
    int column) {
    if (value == null)return null;
    button = (JRadioButton) value;
    button.addItemListener(this);
    return (Component) value;
    public Object getCellEditorValue() {
    button.removeItemListener(this);
    return button;
    public void itemStateChanged(ItemEvent e) {
    super.fireEditingStopped();
    class CheckCellRenderer extends JCheckBox implements TableCellRenderer {
    protected static Border m_noFocusBorder;
    public CheckCellRenderer() {
    super();
    m_noFocusBorder = new EmptyBorder(1, 2, 1, 2);
    setOpaque(true);
    setBorder(m_noFocusBorder);
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
    int row, int column) {
    if (value instanceof Boolean) {
    Boolean b = (Boolean) value;
    setSelected(b.booleanValue());
    setBackground(isSelected && !hasFocus ?
    table.getSelectionBackground() : table.getBackground());
    setForeground(isSelected && !hasFocus ?
    table.getSelectionForeground() : table.getForeground());
    setFont(table.getFont());
    setBorder(hasFocus ? UIManager.getBorder(
    "Table.focusCellHighlightBorder") : m_noFocusBorder);
    return this;
    class CheckBoxHeader extends JCheckBox implements TableCellRenderer, MouseListener {
    protected CheckBoxHeader rendererComponent;
    protected int column;
    protected boolean mousePressed = false;
    public CheckBoxHeader(ItemListener itemListener) {
    rendererComponent = this;
    rendererComponent.addItemListener(itemListener);
    public Component getTableCellRendererComponent(
    JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (table != null) {
    JTableHeader header = table.getTableHeader();
    if (header != null) {
    rendererComponent.setForeground(header.getForeground());
    rendererComponent.setBackground(header.getBackground());
    rendererComponent.setFont(new java.awt.Font("Verdana", 1, 10));
    header.addMouseListener(rendererComponent);
    setColumn(column);
    rendererComponent.setText("Select All");
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    return rendererComponent;
    protected void setColumn(int column) {
    this.column = column;
    public int getColumn() {
    return column;
    protected void handleClickEvent(MouseEvent e) {
    if (mousePressed) {
    mousePressed = false;
    JTableHeader header = (JTableHeader) (e.getSource());
    JTable tableView = header.getTable();
    TableColumnModel columnModel = tableView.getColumnModel();
    int viewColumn = columnModel.getColumnIndexAtX(e.getX());
    int column = tableView.convertColumnIndexToModel(viewColumn);
    if (viewColumn == this.column && e.getClickCount() == 1 && column != -1) {
    doClick();
    public void mouseClicked(MouseEvent e) {
    handleClickEvent(e);
    ( (JTableHeader) e.getSource()).repaint();
    public void mousePressed(MouseEvent e) {
    mousePressed = true;
    public void mouseReleased(MouseEvent e) {
    public void mouseEntered(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    class MyComboBoxRenderer extends JComboBox implements TableCellRenderer {
    public MyComboBoxRenderer(Vector items) {
    super(items);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected) {
    setForeground(table.getSelectionForeground());
    super.setBackground(table.getSelectionBackground());
    else {
    setForeground(table.getForeground());
    setBackground(table.getBackground());
    // Select the current value
    setSelectedItem(value);
    return this;
    class MyComboBoxEditor extends DefaultCellEditor {
    public MyComboBoxEditor(Vector items) {
    super(new JComboBox(items));
    and Bringing data from data base by using this method
    if (i == 0) sqlString = "SELECT * FROM FLIGHTSEARCH WHERE AGENT_CODE='" + agentCode + "' and ISSUEDATE BETWEEN '" + startDate + "' and '" + endDate + "'";
    else sqlString = "SELECT * FROM FLIGHTSEARCH WHERE AGENT_CODE='" + agentCode + "' and JOB_NO='" + JobNo + "%'";
    st = con.createStatement();
    System.out.println("---new jobs search-->" + sqlString);
    rs = st.executeQuery(sqlString);
    while (rs.next()) {
    retVector = new ArrayList();
    retVector.add(0, rs.getString("JOBNO"));
    retVector.add(1, "New Job");
    retVector.add(2, rs.getString("DOC_TYPE"));
    String temp="";
    if(retVector.get(2).toString().trim().equalsIgnoreCase("K1")){
    temp="K8I|K8T";
    }else if(retVector.get(2).toString().trim().equalsIgnoreCase("K2")){
    temp="K8E";
    }else if(retVector.get(2).toString().trim().equalsIgnoreCase("K8I")){
    // temp="K1|K8T";
    }else if(retVector.get(2).toString().trim().equalsIgnoreCase("K8T")){
    temp="K1|K8I";
    }else if(retVector.get(2).toString().trim().equalsIgnoreCase("K8E")){
    temp="K2";
    retVector.add(3,temp);
    retVector.add(3, rs.getString("AGENT_CODE"));
    retVectorlist.add(retVector);
    i am sending data To ComboBox like this
    if(retVector.get(2).toString().trim().equalsIgnoreCase("K1")){
    K8I and K8T
    if K2 adding k8E and for other types as mentioned above
    But for ComboBoxes it is showing same Items not changing
    Please any body can help to me
    Thanks and Regards
    Ravichandra

    If you want further help post a Short, Self Contained, Compilable and Executable, Example Program ([url http://homepage1.nifty.com/algafield/sscce.html]SSCCE) that demonstrates the problem.
    And don't forget to use [url http://forum.java.sun.com/help.jspa?sec=formatting]code formatting when posting code.

  • Need image to update with JComboBox selection

    hello, i have code here that loads an image from a JFileChooser dialog when "Add Image" is clicked, the images name and path is stored in a JComboBox, and the image name is displayed. As more images are added to the JComboBox, I would like to be able to have the picture displayed in concurrence with whatever image is selected from the comboBox. For instance, if Jessica.jpg is selected in the JComboBox, i need Jessica.jpg to be loaded into imagePanel. Here is the code. The problem lies within the JComboBox's "itemStateChanged" I believe... This is what must be used (i think) to update the pictures in the imagePanel when the combobox is manipulated....
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.border.*;
    import java.awt.image.BufferedImage;
    public class MyDialog extends JDialog implements ActionListener, WindowListener, ItemListener
         ReminderClass dataRec;
         ReminderClass originalDataRec;
         Image im;
         MediaTracker mt;
         Toolkit tk;
         JFileChooser imageDialog;
         File f;
         String[] comboBoxList;
         String fileName;
         String filePathName;
         DataManager dataManager;
         JPanel mainPanel1;
         JPanel mainPanel2;
         JPanel mainPanel3;
         JPanel buttonPanel;
         JPanel radioPanel;
         MyImageJPanel imagePanel;
         JScrollPane scrollPane1;
         JScrollPane scrollPane2;
         JRadioButton pendingButton;
         JRadioButton documentationButton;
         JRadioButton completedButton;
         JRadioButton failedButton;
         JRadioButton cancelledButton;
         ButtonGroup radioGroup;
         JComboBox imageComboBox;
         JComboBox category;
         JTextArea description;
         JTextArea message;
         JLabel descriptionLabel;
         JLabel messageLabel;
         JLabel fileNameLabel;
         JLabel categoryLabel;
         JLabel selectedFile;
         GregorianCalendar dueDateTime;
         GregorianCalendar reminderInterval;
         GregorianCalendar terminatedDateTime;
         JButton saveCont;
         JButton cancel;
         JButton addImage;
         JButton saveExit;
         JLabel dueDate;
         JLabel intervalDate;
         JLabel terminatedDate;
         JTextField dueDateField;
         JTextField intervalDateField;
         JTextField terminatedDateField;
         int choice;
         int newIndex;
         public MyDialog(DataManager aDataManager)
         {//add new Reminder to list d-box
              Container cp;
              dataManager = aDataManager;
              dataRec = new ReminderClass();
              imageComboBox = new JComboBox();
              imagePanel = new MyImageJPanel();
              imagePanel.setPreferredSize(new Dimension(40, 40));
              imageComboBox.addItemListener(this);
              mainPanel1 = new JPanel(new BorderLayout());
              mainPanel2 = new JPanel(new BorderLayout());
              mainPanel3 = new JPanel(new GridLayout(7,2));
              radioPanel = new JPanel(new GridLayout(5,1));
              buttonPanel = new JPanel(new FlowLayout());
              saveCont = new JButton ("Save & Continue");
              saveExit = new JButton ("Save & Exit");
              addImage = new JButton ("Add Image(s)");
              cancel = new JButton ("Cancel");
              description = new JTextArea("         ");
              description.setBorder(BorderFactory.createLineBorder(Color.black));
              scrollPane1 = new JScrollPane(description);
              message = new JTextArea("          ");
              scrollPane2 = new JScrollPane(message);
              comboBoxList = CategoryConversion.categories;
              category = new JComboBox(comboBoxList);
              category.setSelectedIndex(0);
              message.setBorder(BorderFactory.createLineBorder(Color.black));
              scrollPane2 = new JScrollPane(message);
              descriptionLabel = new JLabel("Description: ");
              messageLabel = new JLabel("Message: ");
              selectedFile = new JLabel("Selected File(s): ");
              fileNameLabel = new JLabel();
              categoryLabel = new JLabel("Category: ");
              dueDate = new JLabel("Due date: ");
              intervalDate = new JLabel ("Interval date: ");
              terminatedDate = new JLabel ("Terminated date: ");
              dueDateField = new JTextField("   ");
              intervalDateField = new JTextField("   ");
              terminatedDateField = new JTextField("   ");
              pendingButton = new JRadioButton("Pending?");
              documentationButton = new JRadioButton("Documentation?");
              completedButton = new JRadioButton("Completed?");
              failedButton = new JRadioButton("Failed?");
              cancelledButton = new JRadioButton("Cancelled?");
              radioGroup = new ButtonGroup();
              radioGroup.add(pendingButton);
              radioGroup.add(documentationButton);
              radioGroup.add(completedButton);
              radioGroup.add(failedButton);
              radioGroup.add(cancelledButton);
              radioPanel.add(pendingButton);
              radioPanel.add(documentationButton);
              radioPanel.add(completedButton);
              radioPanel.add(failedButton);
              radioPanel.add(cancelledButton);
              pendingButton.addActionListener(this);
              pendingButton.setActionCommand("PENDING");
              documentationButton.addActionListener(this);
              documentationButton.setActionCommand("DOCUMENTATION");
              completedButton.addActionListener(this);
              completedButton.setActionCommand("COMPLETED");
              failedButton.addActionListener(this);
              failedButton.setActionCommand("FAILED");
              cancelledButton.addActionListener(this);
              cancelledButton.setActionCommand("CANCELLED");
              add(mainPanel1);
              mainPanel1.add(mainPanel2, BorderLayout.CENTER);
              mainPanel3.add(descriptionLabel);
              mainPanel3.add(scrollPane1);
              mainPanel3.add(messageLabel);
              mainPanel3.add(scrollPane2);
              mainPanel3.add(selectedFile);
              mainPanel3.add(imageComboBox);
              mainPanel3.add(categoryLabel);
              mainPanel3.add(category);
              mainPanel3.add(dueDate);
              mainPanel3.add(dueDateField);
              mainPanel3.add(intervalDate);
              mainPanel3.add(intervalDateField);
              mainPanel3.add(terminatedDate);
              mainPanel3.add(terminatedDateField);
              mainPanel2.add(radioPanel, BorderLayout.EAST);
              mainPanel2.add(mainPanel3, BorderLayout.WEST);
              buttonPanel.add(addImage);
              buttonPanel.add(saveCont);
              buttonPanel.add(saveExit);
              buttonPanel.add(cancel);
              mainPanel1.add(buttonPanel, BorderLayout.SOUTH);
              mainPanel2.add(imagePanel, BorderLayout.CENTER);
              saveCont.setActionCommand("SAVECONT");
              saveCont.addActionListener(this);
              saveExit.setActionCommand("SAVEEXIT");
              saveExit.addActionListener(this);
              cancel.setActionCommand("CANCEL");
              cancel.addActionListener(this);
              addImage.setActionCommand("ADDIMAGE");
              addImage.addActionListener(this);
              category.addItemListener(this);
              addWindowListener(this);
              description.setInputVerifier(new MyTextAreaVerifier(dataRec, ReminderClass.DESCRIPTION_FIELD));
              message.setInputVerifier(new MyTextAreaVerifier(dataRec, ReminderClass.MESSAGE_FIELD));
              //dueDateField.setInputVerifier(new MyDateAreaVerifier(dataRec, ReminderClass.DUE_DATE_TIME_FIELD));
              //intervalDateField.setInputVerifier(new MyDateAreaVerifier(dataRec, ReminderClass.REMINDER_INTERVAL_FIELD));
              //terminatedDateField.setInputVerifier(new MyDateAreaVerifier(dataRec, ReminderClass.TERMINATED_DATE_TIME_FIELD));
              cp = getContentPane();
              cp.add(mainPanel1);     
              originalDataRec = (ReminderClass)dataRec.clone();
              setupMainFrameAdd();
         public MyDialog(int index, DataManager aDataManager, ReminderClass newDataRec)
         {//edit an existing reminder dialog
              Container cp;
              dataManager = aDataManager;
              index = newIndex;
              dataRec = newDataRec;
              imageComboBox = new JComboBox();
              imagePanel = new MyImageJPanel();
              imagePanel.setPreferredSize(new Dimension(40, 40));
              imageComboBox.addItemListener(this);
              mainPanel1 = new JPanel(new BorderLayout());
              mainPanel2 = new JPanel(new BorderLayout());
              mainPanel3 = new JPanel(new GridLayout(7,2));
              radioPanel = new JPanel(new GridLayout(5,1));
              buttonPanel = new JPanel(new FlowLayout());
              saveCont = new JButton ("Save & Continue");
              saveExit = new JButton ("Save & Exit");
              addImage = new JButton ("Add Image(s)");
              cancel = new JButton ("Cancel");
              description = new JTextArea("         ");
              description.setBorder(BorderFactory.createLineBorder(Color.black));
              scrollPane1 = new JScrollPane(description);
              message = new JTextArea("          ");
              scrollPane2 = new JScrollPane(message);
              comboBoxList = CategoryConversion.categories;
              category = new JComboBox(comboBoxList);
              category.setSelectedIndex(0);
              dataRec.populateComboBox(imageComboBox);
              message.setBorder(BorderFactory.createLineBorder(Color.black));
              scrollPane2 = new JScrollPane(message);
              descriptionLabel = new JLabel("Description: ");
              messageLabel = new JLabel("Message: ");
              selectedFile = new JLabel("Selected File(s): ");
              fileNameLabel = new JLabel();
              categoryLabel = new JLabel("Category: ");
              dueDate = new JLabel("Due date: ");
              intervalDate = new JLabel ("Interval date: ");
              terminatedDate = new JLabel ("Terminated date: ");
              dueDateField = new JTextField("   ");
              intervalDateField = new JTextField("   ");
              terminatedDateField = new JTextField("   ");
              pendingButton = new JRadioButton("Pending?");
              documentationButton = new JRadioButton("Documentation?");
              completedButton = new JRadioButton("Completed?");
              failedButton = new JRadioButton("Failed?");
              cancelledButton = new JRadioButton("Cancelled?");
              radioGroup = new ButtonGroup();
              radioGroup.add(pendingButton);
              radioGroup.add(documentationButton);
              radioGroup.add(completedButton);
              radioGroup.add(failedButton);
              radioGroup.add(cancelledButton);
              radioPanel.add(pendingButton);
              radioPanel.add(documentationButton);
              radioPanel.add(completedButton);
              radioPanel.add(failedButton);
              radioPanel.add(cancelledButton);
              pendingButton.addActionListener(this);
              pendingButton.setActionCommand("PENDING");
              documentationButton.addActionListener(this);
              documentationButton.setActionCommand("DOCUMENTATION");
              completedButton.addActionListener(this);
              completedButton.setActionCommand("COMPLETED");
              failedButton.addActionListener(this);
              failedButton.setActionCommand("FAILED");
              cancelledButton.addActionListener(this);
              cancelledButton.setActionCommand("CANCELLED");
              add(mainPanel1);
              mainPanel1.add(mainPanel2, BorderLayout.CENTER);
              mainPanel3.add(descriptionLabel);
              mainPanel3.add(scrollPane1);
              mainPanel3.add(messageLabel);
              mainPanel3.add(scrollPane2);
              mainPanel3.add(selectedFile);
              mainPanel3.add(imageComboBox);
              mainPanel3.add(categoryLabel);
              mainPanel3.add(category);
              mainPanel3.add(dueDate);
              mainPanel3.add(dueDateField);
              mainPanel3.add(intervalDate);
              mainPanel3.add(intervalDateField);
              mainPanel3.add(terminatedDate);
              mainPanel3.add(terminatedDateField);
              mainPanel2.add(radioPanel, BorderLayout.EAST);
              mainPanel2.add(mainPanel3, BorderLayout.WEST);
              buttonPanel.add(addImage);
              buttonPanel.add(saveCont);
              buttonPanel.add(saveExit);
              buttonPanel.add(cancel);
              mainPanel1.add(buttonPanel, BorderLayout.SOUTH);
              mainPanel2.add(imagePanel, BorderLayout.CENTER);
              fillInData(dataRec);
              saveCont.setActionCommand("SAVECONT2");
              saveCont.addActionListener(this);
              saveExit.setActionCommand("SAVEEXIT2");
              saveExit.addActionListener(this);
              cancel.setActionCommand("CANCEL2");
              cancel.addActionListener(this);
              addImage.setActionCommand("ADDIMAGE");
              addImage.addActionListener(this);
              category.addItemListener(this);
              addWindowListener(this);
              description.setInputVerifier(new MyTextAreaVerifier(dataRec, ReminderClass.DESCRIPTION_FIELD));
              message.setInputVerifier(new MyTextAreaVerifier(dataRec, ReminderClass.MESSAGE_FIELD));
              //dueDateField.setInputVerifier(new MyDateAreaVerifier(dataRec, ReminderClass.DUE_DATE_TIME_FIELD));
              //intervalDateField.setInputVerifier(new MyDateAreaVerifier(dataRec, ReminderClass.REMINDER_INTERVAL_FIELD));
              //terminatedDateField.setInputVerifier(new MyDateAreaVerifier(dataRec, ReminderClass.TERMINATED_DATE_TIME_FIELD));
              cp = getContentPane();
              cp.add(mainPanel1);     
              originalDataRec = (ReminderClass)dataRec.clone();
              setupMainFrameEdit();
         void setupMainFrameAdd()
              tk = Toolkit.getDefaultToolkit();
              Dimension d = tk.getScreenSize();
              setSize(d.width/3, d.height/4);
              setLocation(d.width/3, d.height/3);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setTitle("Reminder Add New");
              setVisible(true);
         }//end of setupMainFrame
         void setupMainFrameEdit()
              tk = Toolkit.getDefaultToolkit();
              Dimension d = tk.getScreenSize();
              setSize(d.width/3, d.height/4);
              setLocation(d.width/3, d.height/3);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setTitle("Edit Existing Reminder");
              setVisible(true);
         public void actionPerformed(ActionEvent e)
              JOptionPane optionPane;
              String temp = new String();
              if (e.getActionCommand().equals("CANCEL"))
                   if(dataRec.compareTo(originalDataRec) != 0)
                        choice = JOptionPane.showConfirmDialog(this, "Are you sure you wish to exit without first saving data?","Are you sure you wish to\n" + "exit without first saving data?", JOptionPane.YES_NO_OPTION);
                        if(choice == JOptionPane.YES_OPTION)
                             dispose();
                        else
                             for (int n = 0; n<imageComboBox.getItemCount(); n++)
                                  dataRec.addImageToArray((String)imageComboBox.getItemAt(n));
                             dataRec.setCategory(category.getSelectedIndex());
                             dataManager.add(dataRec);
                             fillInData(dataRec);
                             dispose();
                   else
                        dispose();
              else if (e.getActionCommand().equals("CANCEL2"))
                   if (dataRec.compareTo(originalDataRec) != 0)
                        choice = JOptionPane.showConfirmDialog(this, "Are you sure you wish to\n" + "exit without first saving data?");
                        if (choice == JOptionPane.YES_OPTION)
                             dispose();
                        else
                             this.dispose();
              else if (e.getActionCommand().equals("ADDIMAGE"))
                   filePathName = new String();
                   fileName = new String();
                   imageDialog = new JFileChooser();
                   imageDialog.showOpenDialog(this);
                   f = imageDialog.getSelectedFile();
                   tk = Toolkit.getDefaultToolkit();
                   fileName = f.getName();
                   filePathName = f.getPath();
                   im = tk.getImage(filePathName);
                   try
                        mt = new MediaTracker(this);
                        mt.addImage(im, 432);
                        mt.waitForAll();
                   catch(InterruptedException ie)
                        ie.getStackTrace();
                   imageComboBox.addItem(fileName);
                   dataRec.setImageFileName(fileName);
                   imageComboBox.setSelectedItem(fileName);
                   imagePanel.refreshImage(im , 50, 50);
              else if (e.getActionCommand().equals("SAVECONT"))
                   for (int n = 0; n<imageComboBox.getItemCount(); n++)
                        dataRec.addImageToArray((String)imageComboBox.getItemAt(n));
                   temp = dueDateField.getText();
                   fileNameLabel.setText("");
                  dataRec.setCategory(category.getSelectedIndex());
                   dataManager.add((ReminderClass)(dataRec.clone()));
                   dataRec.clearFields();
                   fillInData(dataRec);     
              else if (e.getActionCommand().equals("SAVECONT2"))
                   fileNameLabel.setText("");
                  dataRec.setCategory(category.getSelectedIndex());
                   dataManager.replace(newIndex,(ReminderClass)(dataRec.clone()));
                   dataRec.clearFields();
                   fillInData(dataRec);
              else if (e.getActionCommand().equals("SAVEEXIT"))
                   for (int n = 0; n<imageComboBox.getItemCount(); n++)
                        dataRec.addImageToArray((String)imageComboBox.getItemAt(n));
                   dataRec.setCategory(category.getSelectedIndex());
                   dataManager.add(dataRec);
                   fillInData(dataRec);
                   dispose();
                   //save new data to list, and exit back to main prog.
              else if (e.getActionCommand().equals("SAVEEXIT2"))
                   for (int n = 0; n<imageComboBox.getItemCount(); n++)
                        dataRec.addImageToArray((String)imageComboBox.getItemAt(n));
                   dataRec.setCategory(category.getSelectedIndex());
                   dataManager.replace(newIndex, (ReminderClass)(dataRec.clone()));
                   fillInData(dataRec);
                   dispose();
              else if (e.getActionCommand().equals("PENDING"))
                   dataRec.setStatus("Pending");
              else if (e.getActionCommand().equals("DOCUMENTATION"))
                   dataRec.setStatus("Documentation");
              else if (e.getActionCommand().equals("COMPLETED"))
                   dataRec.setStatus("Completed");
              else if (e.getActionCommand().equals("FAILED"))
                   dataRec.setStatus("Failed");
              else if (e.getActionCommand().equals("CANCELLED"))
                   dataRec.setStatus("Cancelled");
         public void itemStateChanged(ItemEvent e)
               JComboBox cb = (JComboBox)e.getSource();
               int categorySelection;
               if(cb == category)
                 categorySelection = cb.getSelectedIndex();
               if (cb == imageComboBox)
                       tk = Toolkit.getDefaultToolkit();
                        fileName = dataRec.getImageFileName();
                        filePathName = f.getPath();
                        im = tk.getImage(filePathName);
                        try
                             mt = new MediaTracker(this);
                             mt.waitForAll();
                             mt.addImage(im, 432);
                             imagePanel.refreshImage(im , 50, 50);
                        catch(InterruptedException ie)
                        ie.getStackTrace();
         public void fillInData(ReminderClass d)
              fileNameLabel.setText(d.getImageFileName());
              description.setText(d.getDescription());
              message.setText(d.getMessage());
              category.setSelectedIndex(d.getCategory());
         public void windowOpened(WindowEvent e)
              //no action to take
         public void windowClosing(WindowEvent e)
              JOptionPane j = new JOptionPane("Are you sure you wish to exit \n" + "without saving data first?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);;
         public void windowClosed(WindowEvent e)
    //          no action to take
         public void windowIconified(WindowEvent e)
    //          no action to take
         public void windowDeiconified(WindowEvent e)
    //          no action to take
         public void windowActivated(WindowEvent e)
    //          no action to take
         public void windowDeactivated(WindowEvent e)
    //          no action to take
    }Here is the main "ReminderClass" with all methods and accessors/mutators....
    import java.util.*;
    import java.awt.*;
    import java.io.*;
    import javax.swing.*;
    //search for Java Thumb Wheel under Google.
    public class ReminderClass extends Object implements Cloneable, Comparable
          private int category;
          private String description;
          private String message;
          private GregorianCalendar dueDateTime;
         private GregorianCalendar reminderInterval;
          private GregorianCalendar terminatedDateTime;
          private int displayStyle;
          private int compareKey;
          private String status;
          String[] imagePathArray;
          String[] imageArray;
          String imageFileName;
          int numImages;
          public final static int CATEGORY_FIELD = 1;
          public final static int DESCRIPTION_FIELD = 2;
          public final static int MESSAGE_FIELD = 3;
          public final static int DUE_DATE_TIME_FIELD = 4;
          public final static int REMINDER_INTERVAL_FIELD =5;
          public final static int TERMINATED_DATE_TIME_FIELD = 6;
          public final static int DISPLAY_STYLE_FIELD = 7;
          public final static int COMPARE_KEY_FIELD = 8;
          public final static int STATUS_FIELD = 9;
          static boolean showDescription = false;
          static boolean showDate = false;
          static boolean showCategory = false;
          static boolean showMessage = false;
          static boolean showDueDateTime = false;
          static boolean showReminderInterval = false;
          static boolean showTerminatedDateTime = false;
          static boolean showImageName = false;
          static boolean showStatus = false;
          //******************REMINDER CLASS DEFAULT CONSTRUCTOR***************
          ReminderClass()
               numImages = 0;
               imageArray = new String[20];
               imagePathArray = new String[20];
               imageFileName = "";
               category = -1;
               description = "";
               message = "";
               dueDateTime = new GregorianCalendar();
               reminderInterval = new GregorianCalendar();
               terminatedDateTime = new GregorianCalendar();
               displayStyle = -1;
               compareKey = -1;
         //     *****************REMINDER CLASS INITIALIZER CONSTRUCTOR*************
          ReminderClass(int initCategory, String initDescription, GregorianCalendar initDueDateTime, String[] initImagePathArray, String[] initImageArray, String initImageFileName,
                    GregorianCalendar initReminderInterval, GregorianCalendar initTerminatedDateTime, String initMessage, String initStatus,
                     int initCompareKey, int initDisplayStyle)
               imagePathArray = new String[20];
               imageArray = new String[20];
               for (int n = 0; n<initImageArray.length; n++)
                    imageArray[n] = initImageArray[n];
               for (int n = 0; n<initImagePathArray.length; n++)
                    imagePathArray[n] = initImagePathArray[n];
                    imageFileName = initImageFileName;
                     category = initCategory;
                     description = initDescription;
                     dueDateTime = (GregorianCalendar)initDueDateTime.clone();
                     reminderInterval = (GregorianCalendar)initReminderInterval.clone();
                     terminatedDateTime = (GregorianCalendar)initTerminatedDateTime.clone();
                     message = initMessage;
                     status = initStatus;
                     compareKey = initCompareKey;
                     displayStyle = initDisplayStyle;
               //*********************LOAD DATA FROM FILE WITH CONSTRUCTOR*****************************
            public ReminderClass(DataInputStream dataInStream) throws IOException
                           imageFileName = dataInStream.readUTF();
                       category = dataInStream.readInt();
                       description = dataInStream.readUTF();
                       message = dataInStream.readUTF();
                       dueDateTime = new GregorianCalendar(dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt());
                       reminderInterval = new GregorianCalendar(dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt()); 
                       terminatedDateTime = new GregorianCalendar(dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt(), dataInStream.readInt());
                       displayStyle = dataInStream.readInt();
                       compareKey = dataInStream.readInt();
                       status = dataInStream.readUTF();
             //********************SAVE DATA TO FILE***************************
             public void write(DataOutputStream dataOutStream) throws IOException
                       dataOutStream.writeUTF(imageFileName);
                       dataOutStream.writeInt(category);
                       dataOutStream.writeUTF(description);
                       dataOutStream.writeUTF(message);
                       dataOutStream.writeInt(dueDateTime.get(Calendar.YEAR));
                       dataOutStream.writeInt(dueDateTime.get(Calendar.MONTH));
                       dataOutStream.writeInt(dueDateTime.get(Calendar.DAY_OF_MONTH));
                       dataOutStream.writeInt(dueDateTime.get(Calendar.HOUR));
                       dataOutStream.writeInt(dueDateTime.get(Calendar.MINUTE));
                       dataOutStream.writeInt(dueDateTime.get(Calendar.SECOND));
                       dataOutStream.writeInt(reminderInterval.get(Calendar.YEAR));
                       dataOutStream.writeInt(reminderInterval.get(Calendar.MONTH));
                       dataOutStream.writeInt(reminderInterval.get(Calendar.DAY_OF_MONTH));
                       dataOutStream.writeInt(reminderInterval.get(Calendar.HOUR));
                       dataOutStream.writeInt(reminderInterval.get(Calendar.MINUTE));
                       dataOutStream.writeInt(reminderInterval.get(Calendar.SECOND));         
                       dataOutStream.writeInt(terminatedDateTime.get(Calendar.YEAR));
                       dataOutStream.writeInt(terminatedDateTime.get(Calendar.MONTH));
                       dataOutStream.writeInt(terminatedDateTime.get(Calendar.DAY_OF_MONTH));
                       dataOutStream.writeInt(terminatedDateTime.get(Calendar.HOUR));
                       dataOutStream.writeInt(terminatedDateTime.get(Calendar.MINUTE));
                       dataOutStream.writeInt(terminatedDateTime.get(Calendar.SECOND));        
                       dataOutStream.writeInt(displayStyle);
                       dataOutStream.writeInt(compareKey);
                       //dataOutStream.writeUTF(status);
             public void clearFields()
                   numImages = 0;
                   imageFileName = "";
                   category = -1;
                    description = "";
                    message = "";
                    dueDateTime = new GregorianCalendar();
                    reminderInterval = new GregorianCalendar();
                    terminatedDateTime = new GregorianCalendar();
                    displayStyle = -1;
                    status = "";
                    compareKey = -1;
               //************* OVERRIDE clone METHOD***********************
               public Object clone() 
                         ReminderClass c = new ReminderClass();
                         try
                              c = ((ReminderClass)super.clone());
                              c.setImageArray(imageArray);
                              c.setImagePathArray(imagePathArray);
                              c.imageFileName = (String)imageFileName;
                              c.category = (int)category;
                              c.description = (String)description;
                              c.message = (String)message;
                              c.status = (String)status;
                              c.compareKey = (int)compareKey;
                              c.displayStyle = (int)displayStyle;
                              c.dueDateTime = (GregorianCalendar)(dueDateTime.clone());
                              c.reminderInterval = (GregorianCalendar)(reminderInterval.clone());
                              c.terminatedDateTime = (GregorianCalendar)(terminatedDateTime.clone());
                         catch (CloneNotSupportedException e)
                              System.out.println("Fatal Error: " + e.getMessage());
                              System.exit(1);
                         return c;
          //**************** OVERRIDE toString METHOD*************************
          public String toString()
               String s = new String();
               s =  description;
              if (showCategory)
                    s = s + "," + CategoryConversion.categories[category];
              if (showImageName)
                   s = s + "," + "'" + imageFileName + "'";
              if (showMessage)
                    s = s + "," + message;
              if (showStatus)
                   s = s + "," + status;
              if (showDueDateTime)
                    s = s + ", " + dueDateTime.get(Calendar.MONTH);
                    s = s + "/" + dueDateTime.get(Calendar.DAY_OF_MONTH);
                    s = s + "/" + dueDateTime.get(Calendar.YEAR);
                    s = s + "  " + dueDateTime.get(Calendar.HOUR);
                    s = s + ":" + dueDateTime.get(Calendar.MINUTE);
                    s = s + ":" + dueDateTime.get(Calendar.SECOND);
              if (showReminderInterval)
                    s = s + ", " + reminderInterval.get(Calendar.MONTH);
                    s = s + "/" + reminderInterval.get(Calendar.DAY_OF_MONTH);
                    s = s + "/" + reminderInterval.get(Calendar.YEAR);
                    s = s + "  " + reminderInterval.get(Calendar.HOUR);
                    s = s + ":" + reminderInterval.get(Calendar.MINUTE);
                    s = s + ":" + reminderInterval.get(Calendar.SECOND);
              if (showTerminatedDateTime)
                    s = s + ", " + terminatedDateTime.get(Calendar.MONTH);
                    s = s + "/" + terminatedDateTime.get(Calendar.DAY_OF_MONTH);
                    s = s + "/" +terminatedDateTime.get(Calendar.YEAR);
                    s = s + "  " + terminatedDateTime.get(Calendar.HOUR);
                    s = s + ":" + terminatedDateTime.get(Calendar.MINUTE);
                    s = s + ":" + terminatedDateTime.get(Calendar.SECOND);
               return s;
          //******************COMPARE TO OBJECT*********************************
          public int compareTo(Object r)
               ReminderClass x;
               x = (ReminderClass)r;
               if (
                   (x.getCategory() == this.category)
               && (x.getDescription().equals(this.description))
               && (x.getMessage().equals(this.message))
               && (x.getImageFileName().equals(this.imageFileName))
               && (x.getDueDateTime().equals(this.dueDateTime))
               && (x.getReminderInterval().equals(this.reminderInterval))
               && (x.getTerminatedDateTime().equals(this.terminatedDateTime))
              return 0;
               else     
              return 1;
          //*************** ACCESSORS AND MUTATORS INCLUDING DISPLAY STYLE*******
          public void setDisplayStyle(int newDisplayStyle)
               displayStyle = newDisplayStyle;
          public int getDisplayStyle()
               return displayStyle;
          public int getCompareKey()
               return compareKey;
          public void setCompareKey(int newCompareKey)
               compareKey = newCompareKey;
          public int getCategory()
               return category;
          public void setImageFileName(String newFileName)
               imageFileName = newFileName;
          public String getImageFileName()
               return imageFileName;
          public void setCategory(int newCategory)
               category = newCategory;
          public String getDescription()
               return description;
          public void setDescription(String newDescription)
               description = newDescription;
          public void setImageArray(String[] array)
               imageArray = new String[20];
               for (int n = 0; n<array.length; n++)
                    imageArray[n] = array[n];
          public void setImagePathArray(String[] array)
               imagePathArray = new String[20];
               for (int n = 0; n<array.length; n++)
                    imagePathArray[n] = array[n];
          public String getImagePathArray(int index)
               return imagePathArray[index];
          public void populateComboBox(JComboBox jcb)
               for (int n = 0; n<numImages; n++)
                     jcb.addItem(imageArray[n]);
          public void addImageToArray(String s)
               imageArray[numImages] = s;
               numImages++;
          public String getMessage()
               return message;
          public void setMessage(String newMessage)
               message = newMessage;     
          public GregorianCalendar getDueDateTime()
               return dueDateTime;
          public void setDueDateTime(int newYear, int newMonth, int newDay, int newHours, int newMins,
                    int newSecs)
              dueDateTime = new GregorianCalendar(newYear, newMonth, newDay, newHours, newMins, newSecs);           
          public GregorianCalendar getReminderInterval()
               return reminderInterval;
          public void setReminderInterval(int newYear, int newMonth, int newDay, int newHours, int newMins,
                   int newSecs)
               reminderInterval = new GregorianCalendar(newYear, newMonth, newDay, newHours, newMins, newSecs);
          public GregorianCalendar getTerminatedDateTime()
               return terminatedDateTime;
          public void setTerminatedDateTime(int newYear, int newMonth, int newDay, int newHours, int newMins,
                   int newSecs)
              terminatedDateTime = new GregorianCalendar(newYear, newMonth, newDay, newHours, newMins, newSecs);      
          public String getStatus()
               return status;
          public void setStatus(String selection)
               status = selection;
          static public void setShowDate(boolean state)
               showDate = state;
          static public boolean getShowDate()
               return showDate;
          static public void setShowCategory(boolean state)
               showCategory = state;
          static public boolean getShowCategory()
               return showCategory;
          static public void setShowImageName(boolean state)
               showImageName = state;
          stat                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

    You don't really expect us to read through 300 lines of code do you?
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.
    In the meantime I suggest you read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html]How to Use Combo Boxes for a working example that does exactly what you want.

Maybe you are looking for

  • Unable to download apps..I get an error

    - My sister gave me her old iPod touch (2nd gen). - It is currently running iOS 3.1.1 (I am unable to upgrade to iOS 4 as I understand that I need OSX 10.5 or higher...and I only have 10.4.11 on my iMac) -I have erased all content and reset the iPod

  • Attachments via Apple Mail

    I've searched and did'nt find an answer to my problem (hopefully I didn't overlook), so I made a post. Lately, my clients and recipients haven't been able to receive my attachments when I send using the Mail.app. If I send a PDF or a regular JPG file

  • Mono playback on external speaker?

    Hello, I'd like to set up FC to playback in mono to two external monitors. I can do this with a fairly expensive cable set-up. If I could set up FC to playback in mono I could use a considerably less expensive system of cables. I've been looking at A

  • Issues with Facetime MacBook Pro os x 10.8.5

    Hi my macbook pro is running os x 10.8.5 and i can't get my facetime or imessenger account to sign in with my apple ID any thoughts? I have done the apple ID check and my email address and password validates. I can also use my iTunes account as well.

  • Clip name to file name

    Needs to be away to make clip names to file names. Some files are loaded by other people. They did not name the file right. It would be nice to have a plugin or apple scrip to do this.