jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes Need help in JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Need help in JComboBox" Watch "Need help in JComboBox" New topic

Need help in JComboBox

Akalya Baskaran

Joined: Nov 15, 2012
Posts: 7

PLease help me in creating a ComboBox with textfield and dropdown list goes like this: When i type a text in the textfield and press "Enter" key,the typed text should be added to the dropdown.
Also the dropdown list should contain all the values entered in the previous page.

Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

If I understood you well, you would attach ActionListener to your JTextField component. The event would be triggered when you enter text and press the Enter key. So accordingly, your actionPerformed(ActionEvent event) method would contain the code to get the text from the field and add it to JComboBox (and probably then clear the text field).

Did you try to implement anything so far? Nobody's going to provide a complete solution for you... Try to follow the directions above and if you have any more doubts feel free to ask again with the code you get.

The quieter you are, the more you are able to hear.
Akalya Baskaran

Joined: Nov 15, 2012
Posts: 7
I didnt try anything still.I will write the code in actionPerformed() method and will let you know.
I agree. Here's the link: http://aspose.com/file-tools
subject: Need help in JComboBox
It's not a secret anymore!