|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Canvas soc.client.AWTToolTip
public class AWTToolTip
A short tooltip for a component. Does not handle component resize or moving, but will respond to hide/un-hide.
To change the tooltip text, call setTip(String)
.
The tooltip adds itself as a listener to the parent component.
If you need to remove this tooltip from the parent, call destroy()
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Canvas |
---|
java.awt.Canvas.AccessibleAWTCanvas |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private boolean |
autoPopup
Does the tooltip automatically appear when mouse enters parentComp ? |
(package private) static java.awt.Color |
bgcol
The background color of the window |
private int |
boxH
Our size |
private int |
boxW
Our size |
private int |
boxX
Our location within parentComp |
private int |
boxY
Our location within parentComp |
int |
closeAfterMoveX
The tip is hidden after the mouse has been moved closeAfterMoveX poinntes horizontally or closeAfterMoveY points vertically away from the point where it has been clicked (or it has left its parent component's area) |
int |
closeAfterMoveY
|
(package private) static java.awt.Color |
fgcol
The foreground color of the window |
private boolean |
isShown
Currently showing? Also indicated by mainParentComp != null. |
protected java.lang.Object |
l_mainParentComp
thread-lock on changes/accesses of mainParentComp |
protected java.awt.Container |
mainParentComp
parentComp's top-level parent, set at mouseEntered; null if not currently visible |
protected java.awt.LayoutManager |
mainParentLayout
true layout manager of mainParentComp; temporarily changed to add the tooltip |
private int |
mousePosAtWinShowX
Mouse location within parentComp |
private int |
mousePosAtWinShowY
Mouse location within parentComp |
static int |
OFFSET_X
X-offset (from mouse location) of tooltip upper-left corner |
static int |
OFFSET_Y
Y-offset (from mouse location) of tooltip upper-left corner |
protected java.awt.Component |
parentComp
Component to which tooltip is notionally added, set in constructor. |
protected int |
parentX
Position of parentComp within painParentComp |
protected int |
parentY
Position of parentComp within painParentComp |
protected java.awt.Font |
tfont
tfont is parentComp.getFont, set at mouseEntered |
private java.lang.String |
tip
|
private boolean |
wantsShown
Want shown? If true, must dynamically add us to parentComp when become visible. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
AWTToolTip(java.lang.String _tip,
java.awt.Component _comp)
Constructs a Tooltip which is displayed when the mouse enters the given component. |
Method Summary | |
---|---|
protected void |
addToParent(int x,
int y)
Add and show tooltip, with mouse at this location. |
void |
componentHidden(java.awt.event.ComponentEvent e)
when parentComp becomes hidden, hide this tooltip if shown. |
void |
componentMoved(java.awt.event.ComponentEvent e)
stub, required for ComponentListener |
void |
componentResized(java.awt.event.ComponentEvent e)
stub, required for ComponentListener |
void |
componentShown(java.awt.event.ComponentEvent e)
When parentComp becomes un-hidden, flag this tooltip to be shown when mouse moves in. |
void |
destroy()
destroys the tooltip. |
static java.awt.Container |
getParentContainer(java.awt.Component c)
Gets the top-level container of c. |
java.lang.String |
getTip()
|
private void |
hideTip()
hides the tooltip. |
void |
mouseClicked(java.awt.event.MouseEvent e)
MouseListener-Methods |
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Must keep out of the way of the mouse pointer. |
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
paint(java.awt.Graphics g)
|
protected void |
removeFromParent()
Hide and remove from a main parent, until addToParent is called (typically from mouseEntered). |
void |
setTip(java.lang.String newTip)
Change the tooltip text. |
protected void |
showAtMouse(int x,
int y)
Show tip at appropriate location when mouse is at (x,y) within mainparent (NOT within parentComp). |
void |
update(java.awt.Graphics g)
|
Methods inherited from class java.awt.Canvas |
---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int closeAfterMoveX
public int closeAfterMoveY
private java.lang.String tip
protected java.awt.Font tfont
protected java.awt.Component parentComp
protected java.awt.Container mainParentComp
protected java.lang.Object l_mainParentComp
protected java.awt.LayoutManager mainParentLayout
protected int parentX
protected int parentY
private int mousePosAtWinShowX
private int mousePosAtWinShowY
private boolean autoPopup
parentComp
?
public static int OFFSET_X
showAtMouse(int, int)
public static int OFFSET_Y
showAtMouse(int, int)
private boolean wantsShown
parentComp
when become visible.
private boolean isShown
private int boxX
private int boxY
private int boxW
private int boxH
static java.awt.Color bgcol
static java.awt.Color fgcol
Constructor Detail |
---|
public AWTToolTip(java.lang.String _tip, java.awt.Component _comp)
_comp
- the Component which this Tooltip describes._tip
- Text to show; single line.Method Detail |
---|
public java.lang.String getTip()
public void setTip(java.lang.String newTip) throws java.lang.IllegalArgumentException
newTip
- New tip text
java.lang.IllegalArgumentException
- if newTip is nullprotected void showAtMouse(int x, int y)
public void update(java.awt.Graphics g)
update
in class java.awt.Canvas
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
protected void removeFromParent()
addToParent(int, int)
protected void addToParent(int x, int y)
x
- Mouse position within parentComp when adding
(NOT within mainparent)y
- Mouse position within parentComp when adding
(NOT within mainparent)removeFromParent()
public static java.awt.Container getParentContainer(java.awt.Component c)
c
- The Component.
private void hideTip()
public void destroy()
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
showAtMouse(int, int)
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void componentHidden(java.awt.event.ComponentEvent e)
componentHidden
in interface java.awt.event.ComponentListener
public void componentMoved(java.awt.event.ComponentEvent e)
componentMoved
in interface java.awt.event.ComponentListener
public void componentResized(java.awt.event.ComponentEvent e)
componentResized
in interface java.awt.event.ComponentListener
public void componentShown(java.awt.event.ComponentEvent e)
componentShown
in interface java.awt.event.ComponentListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |