• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Navigation Event in JTable

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It did help.
Thank you very much.
 
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic