Hi Guys,

I posted earlier, and I figured it out after a few hours of playing around with it.

Now, a new question arises. Is it possible to get the input from a JTextField and add it into a JComboBox via an array?

The only thing stopping me from achieving this I think, is how to put the user input from the JTextField into an array. All I'd have to do after that is access that array though the JComboBox which I do understand.

There's no use for ActionListener here, right? Only for JButtons?

Thanks in advance!

Figured this out as well. Thanks though!

It is better to get the text from the JTextField and add it directly to the JComboBox using the add method of the JComboBox class.
I order to get use the getSelectedItem method of the JComboBox class. It returns an object, so you will need to cast it to a String. Of course for this to work, all the items of the Combo Box need to be of type String.

Just in case, you used an other way to do it, and this one is more helpful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.