Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jTable and jLabel  RSS feed

 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i hide some columns in a jTable and show them in labels in a seperate panel
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to implement your own javax.swing.table.TabelModel or extend the existing javax.swing.table.DefaultTableModel. Make getColumnCount() or getRowCount() return the number of rows or columns your model has minus the ones you want to hide. Then getValueAt will have to do some work to map the rows and cells you want to show to the ones in the model. To know when someone selects a row for display, you have to register as a listener with the JTable's ListSelectionModel. JTable is not a trivial thing to work with, that's why there's extensive coverage on it in the Swing Tutorial
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!