This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class ToolTipManager

java.lang.Object extended by java.awt.event.MouseAdapter extended by javax.swing.ToolTipManager
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener

Most common way to construct:

ToolTipManager toolTipManager = ToolTipManager.sharedInstance();

Based on 9 examples


public class ToolTipManager
extends MouseAdapter
implements MouseMotionListener

Manages all the ToolTips in the system.

ToolTipManager contains numerous properties for configuring how long it will take for the tooltips to become visible, and how long till they hide. Consider a component that has a different tooltip based on where the mouse is, such as JTree. When the mouse moves into the JTree and over a region that has a valid tooltip, the tooltip will become visibile after initialDelay milliseconds. After dismissDelay milliseconds the tooltip will be hidden. If the mouse is over a region that has a valid tooltip, and the tooltip is currently visible, when the mouse moves to a region that doesn't have a valid tooltip the tooltip will be hidden. If the mouse then moves back into a region that has a valid tooltip within reshowDelay milliseconds, the tooltip will immediately be shown, otherwise the tooltip will be shown again after initialDelay milliseconds.


Nested Class Summary
protected class

          
protected class

          
protected class

          
 
Field Summary
protected boolean heavyWeightPopupEnabled
          
protected boolean lightWeightPopupEnabled
          
 
Method Summary
 int

          Returns the dismissal delay value.
 int

          Returns the initial delay value.
 int

          Returns the reshow delay property.
 boolean

          Returns true if this object is enabled.
 boolean

          Returns true if lightweight (all-Java) Tooltips are in use, or false if heavyweight (native peer) Tooltips are being used.
 void

          Called when the mouse is pressed and dragged.
 void

          Called when the mouse enters the region of a component.
 void

          Called when the mouse exits the region of a component.
 void

          Called when the mouse is moved.
 void

          Called when the mouse is pressed.
 void

          Registers a component for tooltip management.
 void
setDismissDelay(int milliseconds)

          Specifies the dismissal delay value.
 void
setEnabled(boolean flag)

          Enables or disables the tooltip.
 void
setInitialDelay(int milliseconds)

          Specifies the initial delay value.
 void

          When displaying the JToolTip, the ToolTipManager chooses to use a lightweight JPanel if it fits.
 void
setReshowDelay(int milliseconds)

          Used to specify the amount of time before the user has to wait initialDelay milliseconds before a tooltip will be shown.
static ToolTipManager

          Returns a shared ToolTipManager instance.
 void

          Removes a component from tooltip control.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

heavyWeightPopupEnabled

protected boolean heavyWeightPopupEnabled

lightWeightPopupEnabled

protected boolean lightWeightPopupEnabled
Method Detail

getDismissDelay

public int getDismissDelay()
Returns the dismissal delay value.

Returns:
an integer representing the dismissal delay value, in milliseconds

getInitialDelay

public int getInitialDelay()
Returns the initial delay value.

Returns:
an integer representing the initial delay value, in milliseconds

getReshowDelay

public int getReshowDelay()
Returns the reshow delay property.

Returns:
reshown delay property

isEnabled

public boolean isEnabled()
Returns true if this object is enabled.

Returns:
true if this object is enabled, false otherwise

isLightWeightPopupEnabled

public boolean isLightWeightPopupEnabled()
Returns true if lightweight (all-Java) Tooltips are in use, or false if heavyweight (native peer) Tooltips are being used.

Returns:
true if lightweight ToolTips are in use

mouseDragged

public void mouseDragged(MouseEvent event)
Called when the mouse is pressed and dragged. Does nothing.

Overrides:
mouseDragged in class MouseAdapter
Parameters:
event - the event in question

mouseEntered

public void mouseEntered(MouseEvent event)
Called when the mouse enters the region of a component. This determines whether the tool tip should be shown.

Overrides:
mouseEntered in class MouseAdapter
Parameters:
event - the event in question

mouseExited

public void mouseExited(MouseEvent event)
Called when the mouse exits the region of a component. Any tool tip showing should be hidden.

Overrides:
mouseExited in class MouseAdapter
Parameters:
event - the event in question

mouseMoved

public void mouseMoved(MouseEvent event)
Called when the mouse is moved. Determines whether the tool tip should be displayed.

Overrides:
mouseMoved in class MouseAdapter
Parameters:
event - the event in question

mousePressed

public void mousePressed(MouseEvent event)
Called when the mouse is pressed. Any tool tip showing should be hidden.

Overrides:
mousePressed in class MouseAdapter
Parameters:
event - the event in question

registerComponent

public void registerComponent(JComponent component)
Registers a component for tooltip management.

This will register key bindings to show and hide the tooltip text only if component has focus bindings. This is done so that components that are not normally focus traversable, such as JLabel, are not made focus traversable as a result of invoking this method.

Parameters:
component - a JComponent object to add

setDismissDelay

public void setDismissDelay(int milliseconds)
Specifies the dismissal delay value.

Parameters:
milliseconds - the number of milliseconds to delay before taking away the tooltip

setEnabled

public void setEnabled(boolean flag)
Enables or disables the tooltip.

Parameters:
flag - true to enable the tip, false otherwise

setInitialDelay

public void setInitialDelay(int milliseconds)
Specifies the initial delay value.

Parameters:
milliseconds - the number of milliseconds to delay (after the cursor has paused) before displaying the tooltip

setLightWeightPopupEnabled

public void setLightWeightPopupEnabled(boolean aFlag)
When displaying the JToolTip, the ToolTipManager chooses to use a lightweight JPanel if it fits. This method allows you to disable this feature. You have to do disable it if your application mixes light weight and heavy weights components.

Parameters:
aFlag - true if a lightweight panel is desired, false otherwise

setReshowDelay

public void setReshowDelay(int milliseconds)
Used to specify the amount of time before the user has to wait initialDelay milliseconds before a tooltip will be shown. That is, if the tooltip is hidden, and the user moves into a region of the same Component that has a valid tooltip within milliseconds milliseconds the tooltip will immediately be shown. Otherwise, if the user moves into a region with a valid tooltip after milliseconds milliseconds, the user will have to wait an additional initialDelay milliseconds before the tooltip is shown again.

Parameters:
milliseconds - time in milliseconds

sharedInstance

public static ToolTipManager sharedInstance()
Returns a shared ToolTipManager instance.

Returns:
a shared ToolTipManager object

unregisterComponent

public void unregisterComponent(JComponent component)
Removes a component from tooltip control.

Parameters:
component - a JComponent object to remove


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.