public class ToolTipManager extends MouseAdapter implements MouseMotionListener
ToolTips 。
ToolTipManager包含许多属性,用于配置工具提示变得可见的时间以及隐藏的时间。 考虑一个基于鼠标位置的不同工具提示的组件,例如JTree。 当鼠标移动到JTree和具有有效工具提示的区域时,工具提示将在initialDelay毫秒后变为可见。 dismissDelay毫秒后,工具提示将被隐藏。 如果鼠标在具有有效工具提示的区域上,并且工具提示当前可见,则当鼠标移动到没有有效工具提示的区域时,工具提示将被隐藏。 然后,如果鼠标移动到reshowDelay毫秒内具有有效工具提示的区域,则工具提示将立即显示,否则工具提示将在initialDelay毫秒之后initialDelay显示。
| Modifier and Type | Class and Description |
|---|---|
protected class |
ToolTipManager.insideTimerAction |
protected class |
ToolTipManager.outsideTimerAction |
protected class |
ToolTipManager.stillInsideTimerAction |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
heavyWeightPopupEnabled |
protected boolean |
lightWeightPopupEnabled |
| Modifier and Type | Method and Description |
|---|---|
int |
getDismissDelay()
返回解雇延迟值。
|
int |
getInitialDelay()
返回初始延迟值。
|
int |
getReshowDelay()
返回重新显示延迟属性。
|
boolean |
isEnabled()
如果启用此对象,则返回true。
|
boolean |
isLightWeightPopupEnabled()
如果轻量级(全Java)
Tooltips正在使用,则返回true;如果使用了重量级(本机对等体)
Tooltips ,则返回false。
|
void |
mouseDragged(MouseEvent event)
当鼠标被按下并拖动时调用。
|
void |
mouseEntered(MouseEvent event)
当鼠标进入组件的区域时调用。
|
void |
mouseExited(MouseEvent event)
当鼠标退出组件的区域时调用。
|
void |
mouseMoved(MouseEvent event)
当鼠标移动时调用。
|
void |
mousePressed(MouseEvent event)
当鼠标被按下时调用。
|
void |
registerComponent(JComponent component)
注册一个用于工具提示管理的组件。
|
void |
setDismissDelay(int milliseconds)
指定解雇延迟值。
|
void |
setEnabled(boolean flag)
启用或禁用工具提示。
|
void |
setInitialDelay(int milliseconds)
指定初始延迟值。
|
void |
setLightWeightPopupEnabled(boolean aFlag)
当显示
JToolTip时,
ToolTipManager选择使用轻巧的
JPanel如果它适合。
|
void |
setReshowDelay(int milliseconds)
用于指定在显示工具提示之前,用户必须等待
initialDelay毫秒的时间量。
|
static ToolTipManager |
sharedInstance()
返回共享的
ToolTipManager实例。
|
void |
unregisterComponent(JComponent component)
从工具提示控件中删除组件。
|
mouseClicked, mouseReleased, mouseWheelMovedprotected boolean lightWeightPopupEnabled
protected boolean heavyWeightPopupEnabled
public void setEnabled(boolean flag)
flag - true启用提示,否则为false
public boolean isEnabled()
public void setLightWeightPopupEnabled(boolean aFlag)
JToolTip时, ToolTipManager选择使用轻巧的JPanel如果它适合。
此方法允许您禁用此功能。
如果您的应用程序混合轻量级和重型组件,则必须禁用它。
aFlag - 如果需要轻量级面板,则为true,否则为false
public boolean isLightWeightPopupEnabled()
Tooltips正在使用,则返回true;如果正在使用重量级(本机对等体)
Tooltips ,则返回false。
ToolTips ,则为true
public void setInitialDelay(int milliseconds)
milliseconds - 在显示工具提示之前,延迟(在光标暂停之后)的毫秒数
getInitialDelay()
public int getInitialDelay()
setInitialDelay(int)
public void setDismissDelay(int milliseconds)
milliseconds - 删除工具提示之前延迟的毫秒数
getDismissDelay()
public int getDismissDelay()
setDismissDelay(int)
public void setReshowDelay(int milliseconds)
initialDelay毫秒的时间量。
也就是说,如果工具提示是隐藏的,并且用户移动到具有内的有效工具提示同一组件的一个区域milliseconds毫秒工具提示会立即被显示。
否则,如果用户在milliseconds毫秒之后移动到具有有效工具提示的区域,则在milliseconds显示工具提示之前,用户将不得不等待initialDelay initialDelay 。
milliseconds - 以毫秒为单位的时间
getReshowDelay()
public int getReshowDelay()
setReshowDelay(int)
public static ToolTipManager sharedInstance()
ToolTipManager实例。
ToolTipManager对象
public void registerComponent(JComponent component)
如果component具有焦点绑定,这将注册键绑定以显示和隐藏工具提示文本。 这样做是为了使调用此方法的结果不会使通过聚焦不可访问的组件(如JLabel )进行聚焦。
component - 一个
JComponent对象添加
Component.isFocusTraversable()
public void unregisterComponent(JComponent component)
component - 要删除的
JComponent对象
public void mouseEntered(MouseEvent event)
mouseEntered在接口
MouseListener
mouseEntered在
MouseAdapter
event - 有关事件
public void mouseExited(MouseEvent event)
mouseExited在界面
MouseListener
mouseExited在
MouseAdapter
event - 有关事件
public void mousePressed(MouseEvent event)
mousePressed在接口
MouseListener
mousePressed在
MouseAdapter
event - 有关事件
public void mouseDragged(MouseEvent event)
mouseDragged在界面
MouseMotionListener
mouseDragged在
MouseAdapter
event - 有关事件
public void mouseMoved(MouseEvent event)
mouseMoved在界面
MouseMotionListener
mouseMoved在
MouseAdapter
event - 有关事件
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.