javax.swing

Class ToolTipManager

  • All Implemented Interfaces:
    MouseListener, MouseMotionListener, MouseWheelListener, EventListener

    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.

    See Also:
    JComponent.createToolTip()
    • Field Detail

      • lightWeightPopupEnabled

        protected boolean lightWeightPopupEnabled
      • heavyWeightPopupEnabled

        protected boolean heavyWeightPopupEnabled
    • Method Detail

      • setEnabled

        public void setEnabled(boolean flag)
        Enables or disables the tooltip.
        Parameters:
        flag - true to enable the tip, false otherwise
      • isEnabled

        public boolean isEnabled()
        Returns true if this object is enabled.
        Returns:
        true if this object is enabled, false otherwise
      • 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
      • 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
      • 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
        See Also:
        getInitialDelay()
      • getInitialDelay

        public int getInitialDelay()
        Returns the initial delay value.
        Returns:
        an integer representing the initial delay value, in milliseconds
        See Also:
        setInitialDelay(int)
      • setDismissDelay

        public void setDismissDelay(int milliseconds)
        Specifies the dismissal delay value.
        Parameters:
        milliseconds - the number of milliseconds to delay before taking away the tooltip
        See Also:
        getDismissDelay()
      • getDismissDelay

        public int getDismissDelay()
        Returns the dismissal delay value.
        Returns:
        an integer representing the dismissal delay value, in milliseconds
        See Also:
        setDismissDelay(int)
      • 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
        See Also:
        getReshowDelay()
      • getReshowDelay

        public int getReshowDelay()
        Returns the reshow delay property.
        Returns:
        reshown delay property
        See Also:
        setReshowDelay(int)
      • sharedInstance

        public static ToolTipManager sharedInstance()
        Returns a shared ToolTipManager instance.
        Returns:
        a shared ToolTipManager object
      • 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
        See Also:
        Component.isFocusTraversable()
      • unregisterComponent

        public void unregisterComponent(JComponent component)
        Removes a component from tooltip control.
        Parameters:
        component - a JComponent object to remove
      • 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.
        Specified by:
        mouseEntered in interface MouseListener
        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.
        Specified by:
        mouseExited in interface MouseListener
        Overrides:
        mouseExited in class MouseAdapter
        Parameters:
        event - the event in question

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

22/12/2024 10:05:50 Cette version de la page est en cache (à la date du 22/12/2024 10:05:50) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.

Document créé le 29/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/ToolTipManager.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, ToolTipManager

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut