aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Navigation Event in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Navigation Event in JTable" Watch "Navigation Event in JTable" New topic
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Navigation Event in JTable
 
Similar Threads
Displaying data in a JTable
JRadioButton in JTable
Disabling the JTable
JTable(!!!)
JTABLE