本文整理汇总了Java中javax.swing.ToolTipManager类的典型用法代码示例。如果您正苦于以下问题:Java ToolTipManager类的具体用法?Java ToolTipManager怎么用?Java ToolTipManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolTipManager类属于javax.swing包,在下文中一共展示了ToolTipManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToolTip
import javax.swing.ToolTipManager; //导入依赖的package包/类
@Override
public JToolTip createToolTip() {
JToolTip t = toolTip;
toolTip = null;
if (t != null) {
t.addMouseMotionListener(new MouseMotionAdapter() { // #233642
boolean initialized = false;
@Override
public void mouseMoved(MouseEvent e) {
if (!initialized) {
initialized = true; // ignore the first event
} else {
// hide the tooltip if mouse moves over it
ToolTipManager.sharedInstance().mousePressed(e);
}
}
});
return t;
} else {
return super.createToolTip();
}
}
示例2: uninstallUI
import javax.swing.ToolTipManager; //导入依赖的package包/类
@Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
ToolTipManager.sharedInstance().unregisterComponent(displayer);
displayer.removePropertyChangeListener (controller);
dataModel.removeChangeListener(controller);
dataModel.removeComplexListDataListener(controller);
selectionModel.removeChangeListener(controller);
displayer.removeMouseListener(controller);
displayer.removeMouseMotionListener(controller);
if (controlButtons != null) {
displayer.remove(controlButtons);
controlButtons = null;
}
layoutModel = null;
selectionModel = null;
dataModel = null;
controller = null;
}
示例3: 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();
}
示例4: hoverChanged
import javax.swing.ToolTipManager; //导入依赖的package包/类
private void hoverChanged() {
String toolTipText;
if (hover != null) {
JComponent jc = hover instanceof JComponent ? (JComponent)hover : null;
Object cn = jc == null ? null : jc.getClientProperty("className");
String name = cn == null ? "" : cn.toString();
toolTipText = name.isEmpty() ? null : name;
} else {
toolTipText = null;
}
// ToolTipManager doesn't like changing the tooltip from mouseMoved().
// This is a workaround to hide the tip when needed and prevent NPEs.
if (toolTipText == null) ToolTipManager.sharedInstance().mousePressed(null);
glassPane.setToolTipText(toolTipText);
repaint();
}
示例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.
*/
@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;
}
}
示例6: getConfiguration
import javax.swing.ToolTipManager; //导入依赖的package包/类
/**
* Makes the dialog visible, and upon exit, returns the configuration to be started.
* @return the selected configuration if the dialog was exited by the start action,
* {@code null} if it was exited in another fashion.
*/
public Object getConfiguration() {
// construct the window
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Exploration configurations");
JPanel contentPanel = new JPanel(new BorderLayout(3, 3));
contentPanel.setBorder(createEmptyBorder());
contentPanel.add(getListPanel(), BorderLayout.WEST);
contentPanel.add(getConfigPanel(), BorderLayout.CENTER);
ToolTipManager.sharedInstance()
.registerComponent(contentPanel);
setContentPane(contentPanel);
pack();
setVisible(true);
return isStart() ? getConfigMap().get(getSelectedName()) : null;
}
示例7: getDisplaysInfoPanel
import javax.swing.ToolTipManager; //导入依赖的package包/类
/**
* Lazily creates and returns the split pane
* containing the displays and info panels.
*/
JSplitPane getDisplaysInfoPanel() {
JSplitPane result = this.displaysInfoPanel;
if (result == null) {
this.displaysInfoPanel = result = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
result.setLeftComponent(getDisplaysPanel());
result.setRightComponent(getDisplaysPanel().getInfoPanel());
result.setOneTouchExpandable(true);
result.setResizeWeight(1);
result.setDividerLocation(0.8);
result.setContinuousLayout(true);
result.setBorder(null);
ToolTipManager.sharedInstance()
.registerComponent(result);
}
return result;
}
示例8: StateTree
import javax.swing.ToolTipManager; //导入依赖的package包/类
/**
* Creates a new state list.
*/
public StateTree(Simulator simulator) {
this.simulator = simulator;
setEnabled(false);
setLargeModel(true);
setRootVisible(false);
setShowsRootHandles(true);
setEnabled(false);
setToggleClickCount(0);
setModel(getModel());
getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
this.setCellRenderer(new DisplayTreeCellRenderer(this));
installListeners();
ToolTipManager.sharedInstance()
.registerComponent(this);
}
示例9: 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();
}
示例10: init
import javax.swing.ToolTipManager; //导入依赖的package包/类
@Override
protected void init() {
super.init();
visibleRect = new Rectangle();
width = 16;
addMouseListener(this);
activeLineRangeStart = activeLineRangeEnd = -1;
setActiveLineRangeColor(null);
// Must explicitly set our background color, otherwise we inherit that
// of the parent Gutter.
updateBackground();
ToolTipManager.sharedInstance().registerComponent(this);
}
示例11: addParser
import javax.swing.ToolTipManager; //导入依赖的package包/类
/**
* Adds a parser for the text area.
*
* @param parser The new parser. If this is <code>null</code>, nothing
* happens.
* @see #getParser(int)
* @see #removeParser(Parser)
*/
public void addParser(Parser parser) {
if (parser!=null && !parsers.contains(parser)) {
if (running) {
timer.stop();
}
parsers.add(parser);
if (parsers.size()==1) {
// Okay to call more than once.
ToolTipManager.sharedInstance().registerComponent(textArea);
}
if (running) {
timer.restart();
}
}
}
示例12: actionPerformed
import javax.swing.ToolTipManager; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
if(e.getSource() == localSettings.MoCr_SettingsFrame_Validation) {
changeResizability(localSettings.isCheckboxSelected());
localAlphabet.setAlphabet(localSettings.getAlphabetInput());
localSettings.setVisible(false);
clearFrame(localSettings.getClearBoxIndex());
setBgColor(localSettings.MoCr_SettingsFrame_Colourbox.getSelectedIndex());
ToolTipManager.sharedInstance().setEnabled(localSettings.MoCr_SettingsFrame_TipCheck.isSelected());
setNewSize();
}
else {
if(e.getSource() == localSettings.MoCr_SettingsFrame_ResetButton) {
localSettings.setStandardAlphabet();
}
}
}
示例13: 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;
}
}
示例14: 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;
}
}
示例15: 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();
}