Redirect Tooltips to a textComponent.

Hi,

I have a simple question. Let's suppose I define a tooltip on a JButton using button.setTooltipText("hi");

Now when the mouse is over the button, the tooltip is shown.

What I want is that instead of showing the small message, the message must be shown in a textcomponent. (like jtextarea).

How can I do that without implementing MouseListener and getting the tooltip and the set it to the right component ?

Is there any way to deal with the tooltip system ?

[500 byte] By [Fantasio2006a] at [2007-10-3 10:31:58]
# 1
> Is there any way to deal with the tooltip system ? Not that I can think of.You can create a custom tooltip component, but the component will still be displayed at the mouse coordinates as a "popup" component.
camickra at 2007-7-15 5:54:52 > top of Java-index,Desktop,Core GUI APIs...
# 2

It's actually just a matter of overriding the getToolTipText(MouseEvent) method in a particular component.

For instance, if you wanted to change the behavior of the tool tip text on a JTable:

JTable jTable1 = new JTable(new DefaultTableModel(2,2)){

public String getToolTipText(MouseEvent e){

System.out.println(this.getToolTipText());

return null;

}

};

jTable1.setToolTipText("Tool Tip in the text window!");

Rather than doing a System.out, you could append to a text area, change a JLabel, or whatever else you want - getToolTipText() returns a string.

MatthewJMurraya at 2007-7-15 5:54:52 > top of Java-index,Desktop,Core GUI APIs...