I hope I am posting this question in right section.
In my swing application, I wanted bind JComboBox to Measurement_Unit table in database. I am using java docking, so multiple forms get loaded at the same time.
Now the problem is, When I change the content of Measurement_Unit table in one form, it doesnt get reflected in other form containing JComboBox until and unless I restart the application or reload the form.
I wanted to know which listener I use to listen the changes in list bound to JComboBox and which type of even I should fire when the data in first form is changed?
When I change the content of Measurement_Unit table in one form, it doesnt get reflected in other form containing JComboBox until and unless I restart the application or reload the form.
Share the model of the combo box across all forms.
Joined: Nov 28, 2009
Thanks alot to both Rob for your response.
@ Rob Prime: Its not swing table, so I cannot add TableModelListener.
@Rob Camick: I think this solution will work, but the problem is, i'll have to create a static object of model, right?
I am looking for a ActionEvent, and ActionListener model for this problem. Like, when the object is added or removed, some ActionEvent should get fired, all the corresponding ComboBox objects should update themselves after listening to this event. Can somebody suggest me a solution for this.
(I am sorry, I don't have much idea about ActionEvent and ActionListener, so a detailed explanation will be very much helpful, or may be some link for beginners.)
No, you most emphatically DO NOT have to "create a static object of model". The way to share the model is simplyIf the combo boxes are in different classes/scopes you will need a method that sets the combo's model, and pass it the shared model as a parameter.
If all you want to do is keep all the JComboBoxes in sync, an ActionListener isn't required for that.
There are no new questions, but there may be new answers.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com