I would like for it to display the name of the object on that icon in a tooltip when hovering over it.[/QB]
You really dont need to take this approach. The JComponent has a getToolTipText() method which returns a String which is displayed as the tooltip. This method is called internally whenever the tooltip is to be displayed. All JComponents are registered with the ToolTipManager by default.
So, what you need to do is make your IconLabel extend the JLabel or some other JComponent. In the constructor, you can accept the object which is to be represented by this IconLabel. Then you just override the getToolTipText() which will return the appropriate String based on the Object.
astThread = new Thread(this); astThread.start(); }
Joined: Sep 09, 2006
Thanks for trying to help. I have been very busy with other things and just got back to this problem. I am using the setTooltipText() method, but it is being completely ignored. Am I missing something? Where do I need to put the getToolTipText?