Re: ***URGENT***How could I make the tooltip test be shown whenever I want
Posted By:
Bahman_Barzideh
Posted On:
Sunday, July 20, 2003 05:48 PM
You can look into two items. First, you can customize tooltip's behaviour
via the ToolTipManager class. Using this class you should
be able to make the tool tip appear immediately (on entering a
JComponent) and stay visible until the mouse leaves the
JComponent. I would guess there are two problems with
this approach for your purposes. First, you mention the tooltip is to
be displayed when a shape is clicked. tooltips do not rely on mouse
clicks for their behaviour, just its motion. The second is that you will
probably need to write a fair amount of code for correct behaviour of
the tooltip since I doubt the shapes you are drawing are JComponents.
Your other option, and I think the better one, is to develop you own
MouseListener. When the mouse is clicked you can display
an undecorated JWindow that contains the text you require (
you would determine the text to be displayed based on the location of the
mouse on your drawing panel). Note that depending on your requirements, you may also need to develop a MouseMotionListener to detect when the mouse leaves
and reenters the JPanel.