Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Refreshing of combo boxes

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 ?

Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Posts: 3648
Mac OS X Firefox Browser 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.
Normally trees don't drive trucks. Does this tiny ad have a license?
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic