aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Refreshing of combo boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Refreshing of combo boxes" Watch "Refreshing of combo boxes" New topic
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
Bartender

Joined: Sep 13, 2007
Posts: 2503
    
    8

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 OCPJP7 OCPWCD5 OCPBCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refreshing of combo boxes