jcombobox selection procedure

hi,When the user selects one item from the combo Box i want a number to be selected which is used else where in the program,, can anybody shed some light on this.Thanks in advance
[200 byte] By [devsua] at [2007-11-26 22:31:59]
# 1

How about shedding some light on it yourself?

What number should be selected? 8? 23? 5.9? Are the numbers in the combo box? Are you talking about the indices of the objects in the combo box? Are the numbers assocaited with objects in the combo box? Are the numbers contained within objects within the combo box?

itchyscratchya at 2007-7-10 11:37:56 > top of Java-index,Desktop,Core GUI APIs...
# 2
its like i have to map between the item selected by the user and some number, i would be using that number elsewhere in the program
devsua at 2007-7-10 11:37:56 > top of Java-index,Desktop,Core GUI APIs...
# 3
If you have to map from one to the other, how about using a Map?If you need to detect the change to the selected item, how about using an ItemListener?
itchyscratchya at 2007-7-10 11:37:56 > top of Java-index,Desktop,Core GUI APIs...
# 4
ok thanx
devsua at 2007-7-10 11:37:56 > top of Java-index,Desktop,Core GUI APIs...
# 5
Or maybe something like this is what you are looking for: http://forum.java.sun.com/thread.jspa?forumID=57&threadID=613731
camickra at 2007-7-10 11:37:56 > top of Java-index,Desktop,Core GUI APIs...
# 6
I think u should extend the DefaultComboBoxModel , which will let u insert two values in the JComboBox or the easier idea is to use hashMap.I have a model which lets you insert two values in the JCombo box
tilekarpoonama at 2007-7-10 11:37:56 > top of Java-index,Desktop,Core GUI APIs...