Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update GUI Component according to events

2807462Mar 17 2016 — edited Mar 17 2016

Hello Experts,

I'm facing this issue in Java Swing. A created a new java class that extends JFrame, added a JPanel, and added the following components:

1- JTextField

2- JButton

3- JCombox

- I enter in the JTextField a value representing a department name, and then I click on the button.

- The button's event handler retrieves the list of employees in the department by executing an SQL statement. The employees are successfully being returned (verified on the console / log).

- the combobox should now be updated with the list of employees, however it's not.

What I'm looking for is a way to update the combobox in correspondence with the department name entered in the JTextField. Instead, the combo box remains empty.

I googled it and found many advising to use 'revalidate' / 'repaint' / 'update', ..... but nothing really works.

Any advice is highly appreciated.

many thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2016
Added on Mar 17 2016
2 comments
1,343 views