I have a problem with an editable JComboBox. When I press my EDIT button, but doesn't do any editing in the JComboBox , and then my OK button I want to get the item in the JComboBox. It is ok when an item in the list is visible but if i have an item which i have put there myself, the call getSelectedItem returns null. I have to klick in the field to get the cursor in it and then its ok. What i want is some method to get the cursor in there. I have tried requestFocus but it doesn't work. please help /Stefan
Joined: May 17, 2001
It has to be selected for getSelectedItem() to return anything but null. You might look into setSelectedItem() and setSelectedIndex().
Joined: Sep 20, 2001
Thank you. I called setSelectedItem() with the previus value before I called getSelectedItem() and it works fine. :-D