| | |
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 |
actuate add android api applet application applications array arrays automation balls bank binary bluetooth business chat class clear client code codesnippet collections component database development dice digit dragging ebook eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health hql html hyper ide idea image infinite int integer invokingapacheantprogrammatically j2me java javame javaprojects jni jpanel julia linux list main map method methods mobile myregfun mysql netbeans nonstatic openjavafx parameter pearl php problem program programming project recursion repositories scanner scrollbar server set sms sort sorting spamblocker sql sqlserver state storm string sun superclass swing swt thread threads tree windows






