Posted on 2007-03-29
Here's the scenario.
I have an object (plan) which contains (string = type of plan, int = price)
I have a gui that lists the plans in a JList and u can click on them and do whatever .
Now i would like to add a filter to it because there are over 500 plans and to scroll down to teh one u need is a pain in the butt.
So i made the filter... its the same concept as the firefox search option... as u type letters it searches for the latest match.
I did this in a JComboBox where i type plan name in the box and its supposed to scroll down to
So i type the name of the plan.. and it scrolls down to it and selects it but once i hit enter ( to verify that its the one i want to select) it doesnt close the combobox drop dow menu and leave the selected lpan int he textfield but instead it shows me the entire object... such as " plan=Info,price=2.03" when its only supposed to say "Info" which is taken from the dropdown menu.
Does anyone know what i have to do to get the names and not the entire object to appear in the textfield after dropdown menu from the combobox goes away?
some of my code
jbox = new JComboBox();
jbox.setRenderer( new PlanBeanCellRenderer() );
OK tbove code SUCCESSFULLY gives the drop down menu from the jcombobox and i can click on a item and it will appear in the textfield ONLY if the next line is true
But this gives an uneditable JComboBox where i cant type to filter stuff out... so that defeats the purpose...
i need to have
However that just displays the entire object on the textfield...
any ideas anyone? or was that too general?