| Author |
Refreshing of combo boxes
|
pramod karnani
Ranch Hand
Joined: May 22, 2007
Posts: 88
|
|
Hi all
I am giving editable combo boxes for name and location search in GUI. So when in changes (delete record /new record insert in db file ) and application is alredy running , that time when user will click on search button in MainWindow then Jtable and both combo boxes (name and location ) should be refreshed also without restarting application , correct ? I am thinking to provide like this , is it okay?
Or should I add a menu-item to refresh combo-boxes , to provide everything in search button functionality will be bit overhead .
on click of search button just provide refresh of Jtable ?
what to do ?
Regards,
Pramod
|
 |
satishkumar janakiraman
Ranch Hand
Joined: May 03, 2004
Posts: 334
|
|
Hi,
As per my understanding the application should not be restarted after every operation (add, modify, delete) to update the UI. Your UI components such as JTable and JCombobox must be refreshed automatically and contain the latest data when your database is changed. If you think, it would be very difficult and error prone, you can provide Retrieve button to retrieve the data from DB.
sat
|
 |
K. Tsang
Ranch Hand
Joined: Sep 13, 2007
Posts: 1219
|
|
Are your search combo boxes part of the table when user clicks search? Like default is like a text field and when search is click, the name and location fields become active combo boxes? Or you open a dialog with combo boxes when user clicks search button?
The dialog version is simple. Suppose your search is an action or implements ActionListener. Inside the actionPerformed method, new JComboBox()...... add it to the dialog window. Oh don't extends JDialog if implementing ActionListener. Because if the search window closes and say you select name as "CCCCCC", without exit opening search window with have the name combo box set to "CCCCCC". Therefore make the dialog as local variable inside actionPerformed.
|
K. Tsang JavaRanch SCJP5 SCJD/OCM-JD
|
 |
 |
|
|
subject: Refreshing of combo boxes
|
|
|