< prev index next >
src/java.desktop/share/classes/javax/swing/ToolTipManager.java
Print this page
*** 29,53 ****
import java.awt.event.*;
import java.awt.*;
import java.util.Objects;
/**
! * Manages all the <code>ToolTips</code> in the system.
* <p>
* 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
! * visible after <code>initialDelay</code> milliseconds. After
! * <code>dismissDelay</code> 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 <code>reshowDelay</code>
* milliseconds, the tooltip will immediately be shown, otherwise the
! * tooltip will be shown again after <code>initialDelay</code> milliseconds.
*
* @see JComponent#createToolTip
* @author Dave Moore
* @author Rich Schiavi
* @since 1.2
--- 29,53 ----
import java.awt.event.*;
import java.awt.*;
import java.util.Objects;
/**
! * Manages all the {@code ToolTips} in the system.
* <p>
* 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
! * visible after {@code initialDelay} milliseconds. After
! * {@code 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 {@code reshowDelay}
* milliseconds, the tooltip will immediately be shown, otherwise the
! * tooltip will be shown again after {@code initialDelay} milliseconds.
*
* @see JComponent#createToolTip
* @author Dave Moore
* @author Rich Schiavi
* @since 1.2
*** 124,136 ****
public boolean isEnabled() {
return enabled;
}
/**
! * When displaying the <code>JToolTip</code>, the
! * <code>ToolTipManager</code> chooses to use a lightweight
! * <code>JPanel</code> 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.
*
* @param aFlag true if a lightweight panel is desired, false otherwise
*
--- 124,136 ----
public boolean isEnabled() {
return enabled;
}
/**
! * When displaying the {@code JToolTip}, the
! * {@code ToolTipManager} chooses to use a lightweight
! * {@code 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.
*
* @param aFlag true if a lightweight panel is desired, false otherwise
*
*** 138,152 ****
public void setLightWeightPopupEnabled(boolean aFlag){
lightWeightPopupEnabled = aFlag;
}
/**
! * Returns true if lightweight (all-Java) <code>Tooltips</code>
* are in use, or false if heavyweight (native peer)
! * <code>Tooltips</code> are being used.
*
! * @return true if lightweight <code>ToolTips</code> are in use
*/
public boolean isLightWeightPopupEnabled() {
return lightWeightPopupEnabled;
}
--- 138,152 ----
public void setLightWeightPopupEnabled(boolean aFlag){
lightWeightPopupEnabled = aFlag;
}
/**
! * Returns true if lightweight (all-Java) {@code Tooltips}
* are in use, or false if heavyweight (native peer)
! * {@code Tooltips} are being used.
*
! * @return true if lightweight {@code ToolTips} are in use
*/
public boolean isLightWeightPopupEnabled() {
return lightWeightPopupEnabled;
}
*** 196,212 ****
return insideTimer.getInitialDelay();
}
/**
* Used to specify the amount of time before the user has to wait
! * <code>initialDelay</code> 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
! * <code>milliseconds</code> milliseconds the tooltip will immediately
* be shown. Otherwise, if the user moves into a region with a valid
! * tooltip after <code>milliseconds</code> milliseconds, the user
! * will have to wait an additional <code>initialDelay</code>
* milliseconds before the tooltip is shown again.
*
* @param milliseconds time in milliseconds
* @see #getReshowDelay
*/
--- 196,212 ----
return insideTimer.getInitialDelay();
}
/**
* Used to specify the amount of time before the user has to wait
! * {@code 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
! * {@code milliseconds} milliseconds the tooltip will immediately
* be shown. Otherwise, if the user moves into a region with a valid
! * tooltip after {@code milliseconds} milliseconds, the user
! * will have to wait an additional {@code initialDelay}
* milliseconds before the tooltip is shown again.
*
* @param milliseconds time in milliseconds
* @see #getReshowDelay
*/
*** 382,394 ****
insideTimer.stop();
}
}
/**
! * Returns a shared <code>ToolTipManager</code> instance.
*
! * @return a shared <code>ToolTipManager</code> object
*/
public static ToolTipManager sharedInstance() {
Object value = SwingUtilities.appContextGet(TOOL_TIP_MANAGER_KEY);
if (value instanceof ToolTipManager) {
return (ToolTipManager) value;
--- 382,394 ----
insideTimer.stop();
}
}
/**
! * Returns a shared {@code ToolTipManager} instance.
*
! * @return a shared {@code ToolTipManager} object
*/
public static ToolTipManager sharedInstance() {
Object value = SwingUtilities.appContextGet(TOOL_TIP_MANAGER_KEY);
if (value instanceof ToolTipManager) {
return (ToolTipManager) value;
*** 401,416 ****
// add keylistener here to trigger tip for access
/**
* Registers a component for tooltip management.
* <p>
* This will register key bindings to show and hide the tooltip text
! * only if <code>component</code> has focus bindings. This is done
* so that components that are not normally focus traversable, such
! * as <code>JLabel</code>, are not made focus traversable as a result
* of invoking this method.
*
! * @param component a <code>JComponent</code> object to add
* @see JComponent#isFocusTraversable
*/
public void registerComponent(JComponent component) {
component.removeMouseListener(this);
component.addMouseListener(this);
--- 401,416 ----
// add keylistener here to trigger tip for access
/**
* Registers a component for tooltip management.
* <p>
* This will register key bindings to show and hide the tooltip text
! * only if {@code component} has focus bindings. This is done
* so that components that are not normally focus traversable, such
! * as {@code JLabel}, are not made focus traversable as a result
* of invoking this method.
*
! * @param component a {@code JComponent} object to add
* @see JComponent#isFocusTraversable
*/
public void registerComponent(JComponent component) {
component.removeMouseListener(this);
component.addMouseListener(this);
*** 421,431 ****
}
/**
* Removes a component from tooltip control.
*
! * @param component a <code>JComponent</code> object to remove
*/
public void unregisterComponent(JComponent component) {
component.removeMouseListener(this);
component.removeMouseMotionListener(moveBeforeEnterListener);
component.removeKeyListener(accessibilityKeyListener);
--- 421,431 ----
}
/**
* Removes a component from tooltip control.
*
! * @param component a {@code JComponent} object to remove
*/
public void unregisterComponent(JComponent component) {
component.removeMouseListener(this);
component.removeMouseMotionListener(moveBeforeEnterListener);
component.removeKeyListener(accessibilityKeyListener);
*** 621,631 ****
}
}
/**
* Checks to see if the tooltip needs to be changed in response to
! * the MouseMoved event <code>event</code>.
*/
private void checkForTipChange(MouseEvent event) {
JComponent component = (JComponent)event.getSource();
String newText = component.getToolTipText(event);
Point newPreferredLocation = component.getToolTipLocation(event);
--- 621,631 ----
}
}
/**
* Checks to see if the tooltip needs to be changed in response to
! * the MouseMoved event {@code event}.
*/
private void checkForTipChange(MouseEvent event) {
JComponent component = (JComponent)event.getSource();
String newText = component.getToolTipText(event);
Point newPreferredLocation = component.getToolTipLocation(event);
< prev index next >