Please see my code below. I am trying to integrate the action listener (commented code) to refresh the table upon table name selection from the combo box and I cannot make it work. What am I missing? Thank you.
You should already have read Oracle's JComboBox tutorial. Far better to read Oracle's tutorials than to wait for people to answer questions on forums. (By the way the tutorial shows you how to use an ActionListener...)
Most code I've seen on the forums would be something like:
If your code isn't working then its probably because either the "tableName" or your code to create the TableModel isn't correct.
If you need more help then post a proper SSCCE. That is we don't have access to your database, so any SQL code is useless to us. Just hardcode the values in the combo box. Same think when you recreate the model. Just use hardecoded values. Once you determine if the ActionListener code is correct, then you can work on your SQL.
Joined: Jul 15, 2011
I figured what the problem was. All the events related to the table set inside the action listener method (different editors and so on....) need to be inside the action listener method. Thank you.