API java : ToolTipManager


javax.swing
Class ToolTipManager

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by javax.swing.ToolTipManager
All Implemented Interfaces:
MouseListener, MouseMotionListener, 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()

Nested Class Summary
protected  class ToolTipManager.insideTimerAction
           
protected  class ToolTipManager.outsideTimerAction
           
protected  class ToolTipManager.stillInsideTimerAction
           
 
Field Summary
protected  boolean heavyWeightPopupEnabled
           
protected  boolean lightWeightPopupEnabled
           
 
Method Summary
 int getDismissDelay()
          Returns the dismissal delay value.
 int getInitialDelay()
          Returns the initial delay value.
 int getReshowDelay()
          Returns the reshow delay property.
 boolean isEnabled()
          Returns true if this object is enabled.
 boolean isLightWeightPopupEnabled()
          Returns true if lightweight (all-Java) Tooltips are in use, or false if heavyweight (native peer) Tooltips are being used.
 void mouseDragged(MouseEvent event)
          Called when the mouse is pressed and dragged.
 void mouseEntered(MouseEvent event)
          Called when the mouse enters the region of a component.
 void mouseExited(MouseEvent event)
          Called when the mouse exits the region of a component.
 void mouseMoved(MouseEvent event)
          Called when the mouse is moved.
 void mousePressed(MouseEvent event)
          Called when the mouse is pressed.
 void registerComponent(JComponent component)
          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 setLightWeightPopupEnabled(boolean aFlag)
          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 sharedInstance()
          Returns a shared ToolTipManager instance.
 void unregisterComponent(JComponent component)
          Removes a component from tooltip control.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseReleased
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

mousePressed

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

Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseAdapter
Parameters:
event - the event in question

mouseDragged

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

Specified by:
mouseDragged in interface MouseMotionListener
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.

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
event - the event in question

Ces informations proviennent du site de http://java.sun.com

Remarques

Contenu

Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :

Quels sont les motivations de cette démarche?

Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.

Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.

Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.

Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.

Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-1646
Document créé le 29/08/06 22:44, dernière modification le Vendredi 17 Juin 2011, 12:12
Source du document imprimé : http://www.gaudry.be/java-api-rf-javax/swing/ToolTipManager.html Document affiché 1 fois ce mois de Juin.
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
15832 documents
452 astuces.
549 niouzes.
3099 definitions.
447 membres.
8115 messages.

Document genere en :
0,37 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
J'ai décidé d'être heureux parce que c'est bon pour la santé.

Voltaire
 
l'infobrol
Nous sommes le Samedi 02 Juin 2012, 04:47, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)