| Author |
Navigation Event in JTable
|
Dvir G.
Greenhorn
Joined: May 31, 2004
Posts: 5
|
|
Well, I didn't get a solution to create a JTable as a row in other JTable, So I changed to UI design for two seperate JTables with Master-Details relations between them. However, I am still having troubles to create the relations between the Tables, by capturing navigation events in the master table and populate the details table with relevant data. Does anyone have an example for it? I didn't find events like CurrentRowChanged or anything near, do you have any idea where should be an event like this? Thanks, Dvir
|
 |
praveen kumar gudapati
Greenhorn
Joined: Sep 26, 2003
Posts: 15
|
|
masterTable.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { DefaultListSelectionModel defaultListSelectionModel = (DefaultListSelectionModel) e.getSource(); if (!defaultListSelectionModel.isSelectionEmpty()) { // get Corresponding Children here and show them in //detail table } else { // clear the children in detail table } } }); The main idea is to add a ListSelectionListener to the master table and keep listening for changes. Hope this helps you.
|
 |
Dvir G.
Greenhorn
Joined: May 31, 2004
Posts: 5
|
|
It did help. Thank you very much.
|
 |
 |
|
|
subject: Navigation Event in JTable
|
|
|