• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to hide a cell in JTable

 
Frank Li
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have two questions and I hope someone can help me.
1)if I have a JTable displaying two columns, one column displays string and the other one displays boolean (a checkbox). Say I have 3 rows in thistable. If I don't want to show the checkbox in the second row, how can I do that?
2) If the string is too long, it gets cut. How can I make the complete string popup when I move the mouse on that cell?
Many thanks in advance.
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) If you are implementing TableModel, don't return Boolean for that column in getColumnClass() method.
If you are using AbstractTableModel and its predecessors, don't set a Boolean Object in DataVector (or so that is used for holding TableData).
2) I think you have to override methods in unserlying UI Classes.
Another simple way is to implement MouseMotionListener, and display a Label with that cell data with Labelx = Cellx, Labely = Celly, LabelHeight = CellHeight, but Label width will be more.
 
Frank Li
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
VIJAY Yadlapati
Thanks for your reply on my questions. Do you have any example code or could you point me to some reference site where I can find examples?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!