Jack Luk wrote:
Could you show me the link which teaches us how to bind a JComboBox to a JTable?
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Ranganathan Kaliyur Mannar wrote:
Jack Luk wrote:
Could you show me the link which teaches us how to bind a JComboBox to a JTable?
I don't understand what you mean by "bind a JComboBox to JTable".
Do you mean having a JComboBox as an editor for one of the columns in a JTable? if so, here's the link
Jack Luk wrote:
Ranganathan Kaliyur Mannar wrote:
Jack Luk wrote:
Could you show me the link which teaches us how to bind a JComboBox to a JTable?
I don't understand what you mean by "bind a JComboBox to JTable".
Do you mean having a JComboBox as an editor for one of the columns in a JTable? if so, here's the link
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Ranganathan Kaliyur Mannar wrote:I don't have any readymade links for that. You just need to add an ItemListener or ActionListener to the combobox and when an item is selected,
you hit the database with a query (with a where clause where you would put the selected item) and bring back data.
And then you add the data to the TableModel which will display the data in a JTable.
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Ranganathan Kaliyur Mannar wrote:There is no simple add() method in JTable to which you can add an object (data).
Have you worked with JComboBox and JTable before? If not, I would suggest you to start reading the tutorial. Particularly the two pages: combo and table
Read the tutorial, write sample code to understand each of these components/concepts separately and then come back to this program.
Jack Luk wrote:
I can get the text from the combo, then query the database and populate the table with the Resultset.
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Ranganathan Kaliyur Mannar wrote:Didn't you say earlier that you wanted to listen for combo box's changes? why are then listening for table selection changes?