From: D. Michael Nelson [mailto:email@example.com]
Sent: Wednesday, August 08, 2001 6:20 PM
To: Eos; Ajug
Subject: Resetting Items In JComboBox?
I am having a problem with JComboBox. I am attempting to reset the item list during excution of the program by using removeAllItems() method followed by addItem() method. However, the addItem() method bombs with an exception (I cannot tell what type of exception was generated because it scrolls off the WIN98 DOS console). After, the exception is generated my JComboBox ActionListener stops working?
It seemed to be straight forward to reset the JComboBox with the above methods, obviously, I am doing something wrong. I have included a code snippet to help illustrate what I am attempting to achieve. Any suggestions? Thanks in advance.
Take It Easy,
D. Michael Nelson
private void setAnnotationCB(Address address)
m_AnnotationCB.addItem((Object)"New");---->generates an exception?
Vector annotationVectors = m_annotationSB.getAnnotationsForAddress(address.getAddressID());
if (annotationVectors.size() > 0)
Iterator annotationIterator = annotationVectors.iterator();
m_rgAnnotations = new AddressService.Annotation[annotationVectors.size()];
int iIndex = 0;
m_rgAnnotations[iIndex++1] = (AddressService.Annotation)annotationIterator.next();
The above line does not work?