• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Refreshing of combo boxes

 
pramod karnani
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 3406
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic