This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes jTable and jLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jTable and jLabel" Watch "jTable and jLabel" New topic

jTable and jLabel

KunkalaGuntala Samba Siva Rao

Joined: Nov 06, 2003
Posts: 20
How do i hide some columns in a jTable and show them in labels in a seperate panel
Joe Ess

Joined: Oct 29, 2001
Posts: 8843

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

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: jTable and jLabel
Similar Threads