Skip to main content

JXTable How do I display the content of a cell when it doesn't fit on the screen

3 replies [Last post]
bwells2004
Offline
Joined: 2007-01-10
Points: 0

When I was at the 2010 javaone conference I went to a swingx 1.6.2 BOP. They were showing new features and enhancements for the next release. One item of interest was in JXTable when you have a cell that contains the ... JXTable would show a tooltip(?) with the remaining content of the cell. It was a very simply to do, but I can't seem to find the demo used or how to accomplish this task. Can someone point me in the right direction? Thanking you in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

table.addHighlighter(new ToolTipHighlighter(HighlightPredicate.IS_TRUNCATED_TEXT));
Karl

bwells2004
Offline
Joined: 2007-01-10
Points: 0

That kinda worked. The problem is I'm using binding on the table and the column has a renderer on it. So, if the column contains "Transfer from ..." and the actual field contains the id, the tooltip shows the id and not the text within the cell. I guess I'll have to find a better way of handling this. Thank you.

kschaefe
Offline
Joined: 2006-06-08
Points: 0

If you use the SwingX rendering you won't have these types of problems. You won't be able to use the simple tools that SwingX provides without using the framework in which we provide it.
That being said, if you implement a StringValue representations for the tool tip highlighter you can probably get the rendering that you want.
Karl