hades.utils
Class ToolTipManager
java.lang.Object
hades.utils.ToolTipManager
- All Implemented Interfaces:
- java.util.EventListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.lang.Runnable
- public class ToolTipManager
- extends java.lang.Object
- implements java.lang.Runnable, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
manage tool-tips on non-Swing GUI components.
ToolTipManager - manage simple tool-tips on non-Swing GUI components.
This class enters itself as a MouseListener and MouseMotionListener
for the GUI component to manage and then starts an internal timer Thread.
On each mouse movement or click of the source component, the timer
is reset. If the timer reaches an (settable) limit, the tooltip
is displayed.
This class uses either a fixed tool-tip message or a context-sensitive
(to either mouse position or time) messages via
the hades.utils.ContextToolTip interface.
The tooltip returned by the getToolTip() method may be a single- or
multiline String, or null (in which case no tooltip is displayed).
After construction of a ToolTipManager, the internal timer thread
runs forever. The display of the messages, however, can be enabled or
disabled by calling ToolTipManager.setEnabled().
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
timeout
protected long timeout
deltat
protected long deltat
t_update
protected long t_update
time
protected long time
enabled
protected boolean enabled
mouseIsInside
protected boolean mouseIsInside
timerThread
protected java.lang.Thread timerThread
toolTipIsVisible
protected boolean toolTipIsVisible
mouse_x
protected int mouse_x
mouse_y
protected int mouse_y
target
protected java.awt.Component target
targetFrame
protected java.awt.Frame targetFrame
tipWindow
protected java.awt.Window tipWindow
tipLabel
protected MultiLineLabel tipLabel
contextToolTip
protected ContextToolTip contextToolTip
fixedToolTip
protected java.lang.String fixedToolTip
ToolTipManager
public ToolTipManager(java.awt.Component target,
long timeout)
ToolTipManager
public ToolTipManager(java.awt.Component target,
ContextToolTip helper,
long timeout)
ToolTipManager
public ToolTipManager(java.awt.Component target,
java.lang.String message,
long timeout)
getEnabled
public boolean getEnabled()
setEnabled
public void setEnabled(boolean enabled)
findFrame
public java.awt.Frame findFrame(java.awt.Component target)
setTimeout
public void setTimeout(long millis)
getTimeout
public long getTimeout()
setDeltaT
public void setDeltaT(long millis)
getDeltat
public long getDeltat()
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
buildToolTipWindow
public void buildToolTipWindow()
showToolTip
public void showToolTip()
hideToolTip
public void hideToolTip()
updateToolTip
public void updateToolTip()
getToolTip
public java.lang.String getToolTip()
checkObjectCanvasPopupIsShowing
public boolean checkObjectCanvasPopupIsShowing()
- check whether our target component is a hades.gui.ObjectCanvas.
If not, return false. Otherwise, return whether the popup menu
on the ObjectCanvas is showing (in which case we do not want
to show the tooltips.)
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent evt)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent evt)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent evt)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent evt)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent evt)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent evt)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent evt)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
keyPressed
public void keyPressed(java.awt.event.KeyEvent evt)
- keyPressed: we will only receive key events on our target component,
if the component has the focus. Similar to mouse events, we hide any
active tooltip, but remember that tooltips are active.
- Specified by:
keyPressed
in interface java.awt.event.KeyListener
keyReleased
public void keyReleased(java.awt.event.KeyEvent evt)
- Specified by:
keyReleased
in interface java.awt.event.KeyListener
keyTyped
public void keyTyped(java.awt.event.KeyEvent evt)
- Specified by:
keyTyped
in interface java.awt.event.KeyListener
msg
public static void msg(java.lang.String s)
main
public static void main(java.lang.String[] argv)