• 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

Master - Detail Tables

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone throw some light on how to create Jtable for Master - Detail tables ?. I need to create two JTables one for master records and another for detail records. Whenever I double click on Master record , Detail table should display corressponding detail records . Do I get any example for this anywhere ?. Thanks for your help.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i need the master-detail too in swing any idea?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add a mouseListener to the table
on double-click populate a tableModel with table1's selection details
set that tableModel as the model for table2
 
Ariel Hernan Landaida Duarte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you show a small example please, i don't understand very well, sorry
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you don't understand the description, example code won't help
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do that with a ListSelectionListener too.
You can read about table selection here (which also has a link to ListSelectionListener).

I would suggest you to start writing the code and get back to us if you're stuck.
 
Ariel Hernan Landaida Duarte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i undestand how to read a row selection and add listener, i don't undestand how to add a JTable for each row of another JTable i like this http://documentation.devexpress.com/#windowsforms/CustomDocument783, thanks
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what you are talking is actually a tree-table and not a table within a table. You can take a look at SwingX which is an open source project and has a component called JXTreeTable.
 
reply
    Bookmark Topic Watch Topic
  • New Topic