knowing when JComboBox's data has changed
Hello, I have a custom JComboBox class where I set a ToolTip for each item. It works in times when I send a populated vector to the class. However, sometimes I need to send an empty vector and populate it later. How can I find out in custom JCB class when my vector has changed in number of elements? I tried to use ListDataListener, but had problems in implementing it. Also, I used ItemListener, but it works only when an item had been selected from JCB at which point it throws NullPointerException and then displays ToolTips correctly. thanks, Alex ___ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing
Re: knowing when JComboBox's data has changed
Aleksandr Kravets wrote: Hello, I have a custom JComboBox class where I set a ToolTip for each item. It works in times when I send a populated vector to the class. However, sometimes I need to send an empty vector and populate it later. How can I find out in custom JCB class when my vector has changed in number of elements? You should wrap a ComboBoxModel around your Vector or subclass DefaultComboBoxModel. As ComboBoxModel is a ListModel, it informs about changes. So if you populate your Vector later, you have to fire (at least) intervalAdded() notifications. -- Christian Pesch - Product Maturity Manager CoreMedia AG - http://www.coremedia.com - 0700-COREMEDIA ___ Advanced-swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/advanced-swing