| | |
JComboBox -- Item is not in the list????????
![]() |
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
I have a "dynamic" JComboBox. What I mean by that is items are removed and added on "the fly".
The getSelectedIndex() is returning -1 when an item is selected. I looked this up and it indicates the selected item is not in the list....What in the world does that mean? The item was added to the ComboBox.
One more thing, the getItemCount() does return the correct number of items..So I don't know why I can't get the selected item or get the selected index.
So, can anyone help me with this?
By the way, I've tried adding a revalidate call but that didn't work.
The getSelectedIndex() is returning -1 when an item is selected. I looked this up and it indicates the selected item is not in the list....What in the world does that mean? The item was added to the ComboBox.
One more thing, the getItemCount() does return the correct number of items..So I don't know why I can't get the selected item or get the selected index.
So, can anyone help me with this?
By the way, I've tried adding a revalidate call but that didn't work.
![]() |
Similar Threads
- Removing an item from head of linked list (C)
- Returning a correct python list (Python)
- Help w/ dynamic list funtction definitions (C++)
Other Threads in the Java Forum
- Previous Thread: Question about java.lang.UnsatisfiedLinkError in MMAPI
- Next Thread: Dont want to display command window
| Thread Tools | Search this Thread |
account android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer homework html ide image inheritance integer integration intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux loop method midlethttpconnection migrate mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program property ria scanner server set sharepoint smart sms smsspam sourcelabs splash sql sqlite subclass support swing testautomation textfield threads tree trolltech unlimited utility windows






