|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.help.ToolTips
An instance of class ToolTips is used to manage the tool tips for a help context. An instance of ToolTips manages
a series of ToolTipListeners which listen to awt components and and display a delayed tool tip when the mouse entered
event happens to the awt component.
Supported API: true
Extendable: false
Nested Class Summary | |
(package private) class |
ToolTips.ToolTipDisplay
Class of object used to display tool tip in window. |
(package private) class |
ToolTips.ToolTipListener
Inner class whos instances listen to a component for tool tip events. |
Field Summary | |
protected Hashtable |
componentListeners
|
protected Container |
container
The component container in which the tool tips will be displayed. |
static long |
DELAY_PRECISION
Since clock precision is about 15 milliseconds. |
protected Thread |
delayThread
|
protected Object |
delayThreadLock
|
protected long |
delayThreadWaitTime
|
protected FontMetrics |
fontMetrics
|
static long |
MAXIMUM_DELAY
Maximum tool tip delay is 20 seconds. |
static long |
MININUM_DELAY
Mininum tool tip delay is 100 milliseconds. |
private static String |
RESOURCE
|
protected static int |
TIP_DISPLAY_HEIGHT_PAD
|
protected static int |
TIP_DISPLAY_INSET
Parameters for displaying the tool tips. |
protected static int |
TIP_DISPLAY_WIDTH_PAD
|
protected int |
TIP_DISPLAY_Y_OFFSET
|
protected Color |
toolTipBackground
The background color for tool tip display. |
protected long |
toolTipDelay
The delay following the mouse entered event, before the tip displays. |
protected ToolTips.ToolTipDisplay |
toolTipDisplay
|
protected Font |
toolTipFont
The font for tool tip display. |
protected Color |
toolTipForeground
The foreground color for tool tip display. |
Constructor Summary | |
ToolTips(Container container)
Construct a ToolTips manager and pass in the container. |
Method Summary | |
void |
addComponentToolTip(Component component,
String tipText)
Add the component and the tip text. |
protected Point |
adjustLocation(Dimension outerSize,
Dimension innerSize,
Point point)
|
Container |
getContainer()
Get the container for the tool tips. |
void |
hideTip()
Hide the currently displayed tool tip. |
void |
removeComponentToolTip(Component component)
Remove the component. |
void |
run()
This method runs when delayThread.start() is invoked. |
protected void |
setContainer(Container newValue)
Set the container for the tool tips. |
void |
setToolTipBackground(Color newValue)
Set the background color for tool tip display. |
void |
setToolTipDelay(long milliSeconds)
Set the amount of time in milliseconds a tool tip display should delay after the mouse rests on a component. |
void |
setToolTipFont(Font newValue)
Set the font for tool tip display. |
void |
setToolTipForeground(Color newValue)
Set the foreground color for tool tip display. |
protected void |
showTip(String tip,
Point point)
Show the tool tip at the specified point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
protected Container container
protected Font toolTipFont
protected Color toolTipBackground
protected Color toolTipForeground
protected long toolTipDelay
public static final long MININUM_DELAY
public static final long MAXIMUM_DELAY
public static final long DELAY_PRECISION
protected static final int TIP_DISPLAY_INSET
protected static final int TIP_DISPLAY_WIDTH_PAD
protected static final int TIP_DISPLAY_HEIGHT_PAD
protected int TIP_DISPLAY_Y_OFFSET
protected ToolTips.ToolTipDisplay toolTipDisplay
protected FontMetrics fontMetrics
protected Hashtable componentListeners
protected Thread delayThread
protected long delayThreadWaitTime
protected Object delayThreadLock
Constructor Detail |
public ToolTips(Container container) throws PropertyVetoException
container
- the container for the tool tip context.
PropertyVetoException
- if the container is invalid.Method Detail |
public Container getContainer()
protected void setContainer(Container newValue) throws PropertyVetoException
newValue
- the new container.
PropertyVetoException
- if the new container is invalid.public void setToolTipFont(Font newValue) throws PropertyVetoException
newValue
- the new font.
PropertyVetoException
- if the new font is invalid.public void setToolTipBackground(Color newValue) throws PropertyVetoException
newValue
- the new background color.
PropertyVetoException
- if the new value is invalid.public void setToolTipForeground(Color newValue) throws PropertyVetoException
newValue
- the new value of the color.
PropertyVetoException
- if the new color is invalid.public void setToolTipDelay(long milliSeconds) throws IllegalArgumentException
IllegalArgumentException
- thrown when param milliseconds is invalid.public void addComponentToolTip(Component component, String tipText)
component
- the component to listen to.tipText
- the text of the tool tip.public void removeComponentToolTip(Component component)
component
- the component to remove from the list of listeners.protected void showTip(String tip, Point point)
tip
- the tip text to be displayed.point
- the display point.public void hideTip()
public void run()
run
in interface Runnable
protected Point adjustLocation(Dimension outerSize, Dimension innerSize, Point point)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |