Re: JComboBox and Textfield
JComboBoxes are usually used to provide for single rather than multiple selections, so when you say "all the users choices" do you mean all the choices that the user has gone through up to that point? If so this would be as simple as
changing
to
Code :
txt.setText(txt.getText() + " " + str);//space or any other delim
Should you wish for multiple selections at a time, you may want to use a series of JCheckBoxes (for smaller numbers) or a JTable (for larger numbers)
Re: JComboBox and Textfield
Copeg Thanks, It does what I want, only problem is it repeats the selection twice instead of once, any ideas why?
Re: JComboBox and Textfield
Quote:
Originally Posted by
Nexusfactor
Copeg Thanks, It does what I want, only problem is it repeats the selection twice instead of once, any ideas why?
Item events are triggered for a variety of events, so you should screen them to get the behavior you want.
Code :
public void itemStateChanged(ItemEvent e){
if ( e.getStateChange() == ItemEvent.SELECTED ){
//your code here
}
}