Skip to main content

Jcombo box

2 replies [Last post]
Joined: 2012-05-01

Can any one help me on how to insert jcombobox item selected into mysql

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2012-09-28

Are you really asking 2 questions?
First, how to get the value from the JComboBox
and second, how to write the value to the database.

If we presume that you know how to write any value to the database,
then what you really need is the first.

You can add logic as below:
combo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
System.out.println("Combo: " + combo.getSelectedItem());

You can do what you want with the item selected.

Joined: 2012-05-01

Your sugestion regarding my problem always nib them in the bud. The problem is now resolved. Thanks alot