> i want to use tooltips with a jtable. I have successfully tried with
> setToolTipText in the method getTableCellRendererComponent() in the
> TableCellRenderer. But on every repaint of the jtable the method
> getTableCellRenderer() sets all the tooltip texts. This is bad because
> the tooltip gets its text from some objects from a remote server which
> is not very fast. So far.
You can just override JTable.getToolTipText(MouseEvent) and only look
up the tooltip there instead of using the default behaviour of trying
to pick the renderer's tool tip text.
> The idea is to use a mouse listener on the jtable. On double-click my
> own tooltip should appear.
> I tried something like this (no result):
What does "no result" mean? Please post compilable code next time.
> public class mlTable extends MouseAdapter {
> public void mouseClicked(MouseEvent e) {
[quoted text clipped - 6 lines]
> tp.setComponenent( ((myTable)e.getSource()).getComponentAt(
> e.getPoint()) .... );
Eh, why not "tp.setComponent(tTable)"?
> tp.setVisible(true);
Use Popup/PopupFactory to show the tooltip.
> }
> }
> }
>
> Beside where is the difference between setTipText(String) and
> setToolTipText(String) ?
setTipText sets the text the JToolTip displays. setToolTipText sets the
text that a (default) tooltip for the component you set it on displays.
Christian