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

Problem with JTable and ToolTips  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a problem with ToolTips and my JTable.
I am creating my Tooltips via information in a database. I have a class that extends DefaultTableCellRenderer and I use the setToolTipText(String) method. The problem is when I tell my Table to use the Renderer I have created. It requires a column class in the method and all my columns are Strings so I pass it String.class. My table has no data, yet all the Cells are showing, and the information is in the TableModel and the Tooltips show up correctly. But like I said, all the cells are empty.
My code is rather long, so I won't post it unless someone really needs to see it. If anyone has had this problem before, could you help me?
Thanks.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to mention that I also have my own custom TableModel class that extends DefaultTableModel.
I have a feeling that it has something to do with this. That the DefaultTableCellRenderer is somehow rendering the table, but the Model doesn't get rendered anymore. I don't know. Still working on it and just guessing.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I figured out what I was doing wrong. I left the following code out of my DefaultTableCellRenderer:
Component renderer = super.getTableCellRendererComponent (table, value, isSelected, hasFocus, row, column);
Now it works fine.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!