0

I'm using the PropertyTable from JIDE and I'm having a problem with tooltips when hovering over a table cell.

This table uses JTooltip and if I have on one cell a string containing html like this:

<b>BOLD</b>

When hovering over, the tooltip will display it like this:

BOLD

I tried reading the PropertyTable and JTooltip docs, but can't find anything. From what I've found in other questions here on stackoverflow, the JTooltip display the resulted html code if you enclose the string value like this:

<html><b>BOLD</b></html>

, but here it's not the case.

Is there any way to show the string value inside the tooltip? I can't seem to find anything in the docs of JTooltip.

Thank you!

1 Answers1

0

The tool tip is provided by the TableCellRenderer, which by default return the TOOL_TIP_TEXT_KEY client property. You may try to override the TableCellRenderer (which should be PropertyTableCellRenderer) and either:

  • Override TableCellRenderer::getToolTipText(MouseEvent)
  • Try to call setToolTip(String) in getTableCellRendererComponent

You could also try to overrides PropertyTable::getToolTipText(MouseEvent) but you'll have to re-implement quite a bit of logic.

NoDataFound
  • 11,381
  • 33
  • 59
  • I found that the PropertyTable::getToolTipText(MouseEvent) adds tags to the tooltip text if JideTable.jb is equal to 0. But I can't find what jb means. Also, is there any way to disable the way JToolTip interprets text? I mean even if tags are present to make the tooltip show the string and not the html result – user3165587 Jun 24 '19 at 09:30
  • I don't think JIDE, or Swing, provide that by default. It is up to you to call such function, for example using `Jsoup.parse(html).text()`. You could also not use HTML at all and do a cell renderer using a bold font if that's only what you are doing. – NoDataFound Jun 24 '19 at 11:12
  • I don't know if I understand you correctly, but I don't want to render bold or anything inside the cell and tooltip, I want to render the text, even if the text is `this should not be bold`. So I want to see the text with the tags and everything. Thank you for your time :) – user3165587 Jun 24 '19 at 11:57