本文整理汇总了Java中javax.swing.ToolTipManager.sharedInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ToolTipManager.sharedInstance方法的具体用法?Java ToolTipManager.sharedInstance怎么用?Java ToolTipManager.sharedInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ToolTipManager
的用法示例。
在下文中一共展示了ToolTipManager.sharedInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invokeTip
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/** Hack to invoke tooltip on given JComponent, with given dismiss delay.
* Triggers <br>
* <code>comp.getToolTipText(MouseEvent)</code> and
* <code>comp.getToolTipLocation(MouseEvent)</code> with fake mousemoved
* MouseEvent, set to given coordinates.
*/
public static void invokeTip (JComponent comp, int x, int y, int dismissDelay) {
final ToolTipManager ttm = ToolTipManager.sharedInstance();
final int prevInit = ttm.getInitialDelay();
prevDismiss = ttm.getDismissDelay();
ttm.setInitialDelay(0);
ttm.setDismissDelay(dismissDelay);
MouseEvent fakeEvt = new MouseEvent(
comp, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(),
0, x, y, 0, false);
ttm.mouseMoved(fakeEvt);
ttm.setInitialDelay(prevInit);
Timer timer = new Timer(20, instance());
timer.setRepeats(false);
timer.start();
}
示例2: mouseEntered
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse entered' event. This method changes the tooltip delays of
* ToolTipManager.sharedInstance() to the possibly different values set for this chart panel.
*
* @param e
* the mouse event.
*/
@Override
public void mouseEntered(MouseEvent e) {
if (!this.ownToolTipDelaysActive) {
ToolTipManager ttm = ToolTipManager.sharedInstance();
this.originalToolTipInitialDelay = ttm.getInitialDelay();
ttm.setInitialDelay(this.ownToolTipInitialDelay);
this.originalToolTipReshowDelay = ttm.getReshowDelay();
ttm.setReshowDelay(this.ownToolTipReshowDelay);
this.originalToolTipDismissDelay = ttm.getDismissDelay();
ttm.setDismissDelay(this.ownToolTipDismissDelay);
this.ownToolTipDelaysActive = true;
}
}
示例3: actionPerformed
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Runnable runnable = new Runnable() {
@Override
public void run() {
javax.swing.ToolTipManager toolTipManager =
ToolTipManager.sharedInstance();
if (toolTipManager.isEnabled()) {
toolTipManager.setEnabled(false);
Gate.getUserConfig().put(
MainFrame.class.getName()+".hidetooltips", false);
} else {
toolTipManager.setEnabled(true);
Gate.getUserConfig().put(
MainFrame.class.getName()+".hidetooltips", true);
}
}
};
Thread thread = new Thread(runnable, "ToggleToolTipsAction");
thread.start();
}
示例4: mouseEntered
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse entered' event. This method changes the tooltip delays of
* ToolTipManager.sharedInstance() to the possibly
* different values set for this chart panel.
*
* @param e the mouse event.
*/
public void mouseEntered(MouseEvent e) {
if (!this.ownToolTipDelaysActive) {
ToolTipManager ttm = ToolTipManager.sharedInstance();
this.originalToolTipInitialDelay = ttm.getInitialDelay();
ttm.setInitialDelay(this.ownToolTipInitialDelay);
this.originalToolTipReshowDelay = ttm.getReshowDelay();
ttm.setReshowDelay(this.ownToolTipReshowDelay);
this.originalToolTipDismissDelay = ttm.getDismissDelay();
ttm.setDismissDelay(this.ownToolTipDismissDelay);
this.ownToolTipDelaysActive = true;
}
}
示例5: mouseEntered
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse entered' event. This method changes the tooltip delays
* of ToolTipManager.sharedInstance() to the possibly different values set
* for this chart panel.
*
* @param e the mouse event.
*/
public void mouseEntered(MouseEvent e) {
if (!this.ownToolTipDelaysActive) {
ToolTipManager ttm = ToolTipManager.sharedInstance();
this.originalToolTipInitialDelay = ttm.getInitialDelay();
ttm.setInitialDelay(this.ownToolTipInitialDelay);
this.originalToolTipReshowDelay = ttm.getReshowDelay();
ttm.setReshowDelay(this.ownToolTipReshowDelay);
this.originalToolTipDismissDelay = ttm.getDismissDelay();
ttm.setDismissDelay(this.ownToolTipDismissDelay);
this.ownToolTipDelaysActive = true;
}
}
示例6: main
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
ToolTipManager manager = ToolTipManager.sharedInstance();
if (DISMISS != manager.getDismissDelay()) {
throw new Error("unexpected dismiss delay");
}
if (INITIAL != manager.getInitialDelay()) {
throw new Error("unexpected initial delay");
}
if (RESHOW != manager.getReshowDelay()) {
throw new Error("unexpected reshow delay");
}
manager.setDismissDelay(DISMISS + 1);
manager.setInitialDelay(INITIAL + 1);
manager.setReshowDelay(RESHOW + 1);
ThreadGroup group = new ThreadGroup("$$$");
Thread thread = new Thread(group, new Test6657026());
thread.start();
thread.join();
}
示例7: mouseEntered
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse entered' event. This method changes the tooltip delays
* of ToolTipManager.sharedInstance() to the possibly different values set
* for this chart panel.
*
* @param e the mouse event.
*/
@Override
public void mouseEntered(MouseEvent e) {
if (!this.ownToolTipDelaysActive) {
ToolTipManager ttm = ToolTipManager.sharedInstance();
this.originalToolTipInitialDelay = ttm.getInitialDelay();
ttm.setInitialDelay(this.ownToolTipInitialDelay);
this.originalToolTipReshowDelay = ttm.getReshowDelay();
ttm.setReshowDelay(this.ownToolTipReshowDelay);
this.originalToolTipDismissDelay = ttm.getDismissDelay();
ttm.setDismissDelay(this.ownToolTipDismissDelay);
this.ownToolTipDelaysActive = true;
}
}
示例8: init
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
public static void init(UIDefaults d)
{
d.put("ToolTipUI", AgToolTipUI.class.getName());
d.put("ToolTipManager.enableToolTipMode", "activeApplication");
d.put("ToolTip.background", Theme.TOOL_TIP_BG);
d.put("ToolTip.backgroundInactive", Theme.TOOL_TIP_BG);
d.put("ToolTip.border", BORDER);
d.put("ToolTip.borderInactive", BORDER);
d.put("ToolTip.foreground", Theme.TEXT_FG);
d.put("ToolTip.foregroundInactive", Theme.FIELD_FG);
d.put("ToolTip.hideAccelerator", Boolean.FALSE);
// defs.put("ToolTip.font" // set by ATheme
// configure tooltips
ToolTipManager m = ToolTipManager.sharedInstance();
m.setInitialDelay(50);
m.setDismissDelay(Integer.MAX_VALUE);
// TODO more intelligent placement of tool tips - need to overwrite each component
}
示例9: interactiveHierarchicalToolTip
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Issue #??-swingx: Tooltip by highlighter in hierarchical column
*
* Issue #1527-swingx: tooltip not shown after changing expansion state.
*
* Not reliably updated (independent on whether to use a Highlighter or core renderer
* with Highlighter set, also @see {@link #interactiveTestToolTipsCoreRenderer()}
*
* To reproduce:
* - move to some row over the hierarchical column where the tooltip is showing
* - move the next row, typically the tooltip is not showing (no, can't reproduce)
* - reproducible (from bug report): collapse/expand the row, then move (in same or
* other row): tooltip not shown until the mouse has been moved completely outside
* of the table
*
* Seems to happen, if the tooltip was hidden due to the collapse/expose. To reproduce
* - move to show the tooltip in hierarchical column
* - wait until it is hidden by the tooltipManager
* - collapse/expand and move: tooltip shown again
*
*/
public void interactiveHierarchicalToolTip() {
ToolTipManager manager = ToolTipManager.sharedInstance();
final JXTreeTable table = new JXTreeTable(treeTableModel);
Highlighter toolTip = new AbstractHighlighter(
new AndHighlightPredicate(
new ColumnHighlightPredicate(0), HighlightPredicate.ROLLOVER_ROW)) {
@Override
protected Component doHighlight(Component component,
ComponentAdapter adapter) {
((JComponent) component).setToolTipText(adapter.getString());
return component;
}
};
table.addHighlighter(toolTip);
JXFrame frame = wrapWithScrollingInFrame(table, "ToolTip with Highlighter (hierarchical column)");
addComponentOrientationToggle(frame);
addStatusComponent(frame, new JTextField("something to focus"));
frame.setVisible(true);
}
示例10: mouseEntered
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse entered' event. This method changes the tooltip delays
* of ToolTipManager.sharedInstance() to the possibly different values set
* for this chart panel.
*
* @param e the mouse event.
*/
public void mouseEntered(MouseEvent e) {
if (!this.ownToolTipDelaysActive) {
ToolTipManager ttm = ToolTipManager.sharedInstance();
this.originalToolTipInitialDelay = ttm.getInitialDelay();
ttm.setInitialDelay(this.ownToolTipInitialDelay);
this.originalToolTipReshowDelay = ttm.getReshowDelay();
ttm.setReshowDelay(this.ownToolTipReshowDelay);
this.originalToolTipDismissDelay = ttm.getDismissDelay();
ttm.setDismissDelay(this.ownToolTipDismissDelay);
this.ownToolTipDelaysActive = true;
}
}
示例11: MapPanel
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
public MapPanel() {
MPAdapter ad = new MPAdapter();
addComponentListener(ad);
poly = new ArrayList<MapPoly>();
// map = new BufferedImage(1600, 800, BufferedImage.TYPE_INT_RGB);
// grat = new BufferedImage(1600, 800, BufferedImage.TYPE_4BYTE_ABGR);
// setOrtho();
setWinkel();
setToolTipText("Hover for tile info");
ToolTipManager tm = ToolTipManager.sharedInstance();
tm.setDismissDelay(999999);
tm.setInitialDelay(0);
tm.setReshowDelay(0);
}
示例12: mouseExited
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse exited' event. This method resets the tooltip delays of
* ToolTipManager.sharedInstance() to their original values in effect before mouseEntered()
*
* @param e
* the mouse event.
*/
@Override
public void mouseExited(MouseEvent e) {
if (this.ownToolTipDelaysActive) {
// restore original tooltip dealys
ToolTipManager ttm = ToolTipManager.sharedInstance();
ttm.setInitialDelay(this.originalToolTipInitialDelay);
ttm.setReshowDelay(this.originalToolTipReshowDelay);
ttm.setDismissDelay(this.originalToolTipDismissDelay);
this.ownToolTipDelaysActive = false;
}
}
示例13: showToolTipNow
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
public static void showToolTipNow(JComponent component) {
// HACKHACK: trick the tooltip manager into showing the tooltip right now
ToolTipManager manager = ToolTipManager.sharedInstance();
int oldDelay = manager.getInitialDelay();
manager.setInitialDelay(0);
manager.mouseMoved(new MouseEvent(component, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, 0, 0, 0, false));
manager.setInitialDelay(oldDelay);
}
示例14: mouseExited
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
/**
* Handles a 'mouse exited' event. This method resets the tooltip delays of
* ToolTipManager.sharedInstance() to their
* original values in effect before mouseEntered()
*
* @param e the mouse event.
*/
public void mouseExited(MouseEvent e) {
if (this.ownToolTipDelaysActive) {
// restore original tooltip dealys
ToolTipManager ttm = ToolTipManager.sharedInstance();
ttm.setInitialDelay(this.originalToolTipInitialDelay);
ttm.setReshowDelay(this.originalToolTipReshowDelay);
ttm.setDismissDelay(this.originalToolTipDismissDelay);
this.ownToolTipDelaysActive = false;
}
}
示例15: run
import javax.swing.ToolTipManager; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
ToolTipManager manager = ToolTipManager.sharedInstance();
if (DISMISS != manager.getDismissDelay()) {
throw new Error("shared dismiss delay");
}
if (INITIAL != manager.getInitialDelay()) {
throw new Error("shared initial delay");
}
if (RESHOW != manager.getReshowDelay()) {
throw new Error("shared reshow delay");
}
}