• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How to hide a cell in JTable

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic