Lei Gao said:
=>Looks to me a JCheckBox can not coexist with a JComboBox?
=>
=>Here is the code. Everytime you click the JCheckBox then you will triger the
=>actionPerformed method of the JComboBox. I dont know if this is a known bug 
=>or not.
=>

If I understand correctly you want a JCheckBox as an entry in a JComboBox. Your 
combo box actionPerformed should just select/unselect the check box item. Then 
the check box action performed will do its job:

    cb.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        JComboBox c = (JComboBox)e.getSource();
        JCheckBox item = (JCheckBox)c.getSelectedItem();
        item.setSelected(!item.isSelected());
        c.getModel().setSelectedItem(new JLabel());
        c.repaint();
      }
    });
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Patricia.A.Keith        And how are you spending your dash?
NASA Glenn Research Center
at Lewis Field            
Cleveland, OH             
Phone: (216) 433-5191               
Fax:   (216) 433-8000
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to