| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.event.MouseAdapter
javax.swing.ToolTipManager
public class ToolTipManager
管理系统中的所有 ToolTips。
 
ToolTipManager 包含众多属性,用于配置该工具提示需要多长时间显示出来,需要多长时间隐藏。考虑一个在不同的鼠标位置(如 JTree)有不同工具提示的组件。在鼠标移动到 JTree 中和具有有效工具提示的区域上时,该工具提示将在 initialDelay 毫秒后显示出来。在 dismissDelay 毫秒后,将隐藏该工具提示。如果鼠标在具有有效工具提示的区域上,并且当前能看到该工具提示,则在鼠标移动到没有有效工具提示的区域时,将隐藏该工具提示。如果鼠标接下来在 reshowDelay 毫秒内移回具有有效工具提示的区域,则将立即显示该工具提示,否则在 initialDelay 毫秒后将再次显示该工具提示。
JComponent.createToolTip()| 嵌套类摘要 | |
|---|---|
| protected  class | ToolTipManager.insideTimerAction | 
| protected  class | ToolTipManager.outsideTimerAction | 
| protected  class | ToolTipManager.stillInsideTimerAction | 
| 字段摘要 | |
|---|---|
| protected  boolean | heavyWeightPopupEnabled | 
| protected  boolean | lightWeightPopupEnabled | 
| 方法摘要 | |
|---|---|
|  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)从工具提示控件中移除一个组件。 | 
| 从类 java.awt.event.MouseAdapter 继承的方法 | 
|---|
| mouseClicked, mouseReleased, mouseWheelMoved | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 字段详细信息 | 
|---|
protected boolean lightWeightPopupEnabled
protected boolean heavyWeightPopupEnabled
| 方法详细信息 | 
|---|
public void setEnabled(boolean flag)
flag - 要启用提示则为 true,否则为 falsepublic boolean isEnabled()
public void setLightWeightPopupEnabled(boolean aFlag)
JToolTip 时,该 ToolTipManager 会选择使用一个轻量级 JPanel(如果合适)。此方法允许您禁用该功能。如果应用程序混合轻量级组件和重量级组件,则必须真正禁用此功能。
aFlag - 如果需要轻量级面板,则为 true,否则为 falsepublic boolean isLightWeightPopupEnabled()
Tooltips,则返回 true;如果使用重量级(本机同位体)Tooltips,则返回 false。
ToolTipspublic 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 毫秒之后移动到具有有效工具提示的区域,则用户必须在再次显示该工具提示之前再等待 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)
MouseListener 中的 mouseEnteredMouseAdapter 中的 mouseEnteredevent - 相关事件public void mouseExited(MouseEvent event)
MouseListener 中的 mouseExitedMouseAdapter 中的 mouseExitedevent - 相关事件public void mousePressed(MouseEvent event)
MouseListener 中的 mousePressedMouseAdapter 中的 mousePressedevent - 相关事件public void mouseDragged(MouseEvent event)
MouseMotionListener 中的 mouseDraggedMouseAdapter 中的 mouseDraggedevent - 相关事件public void mouseMoved(MouseEvent event)
MouseMotionListener 中的 mouseMovedMouseAdapter 中的 mouseMovedevent - 相关事件| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。