當前位置: 首頁>>代碼示例>>Java>>正文


Java ToolTipManager類代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:Outline.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:AbstractViewTabDisplayerUI.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:TooltipHack.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ComponentDetailsProvider.java

示例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;
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:26,代碼來源:AbstractChartPanel.java

示例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;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:21,代碼來源:ConfigDialog.java

示例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;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:21,代碼來源:Simulator.java

示例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);
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:19,代碼來源:StateTree.java

示例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();
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:22,代碼來源:MainFrame.java

示例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);

}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:19,代碼來源:IconRowHeader.java

示例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();
		}
	}
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:24,代碼來源:ParserManager.java

示例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();
        }
    }
}
 
開發者ID:PSeminarKryptographie,項目名稱:MonkeyCrypt,代碼行數:17,代碼來源:MoCr_SettingsAL.java

示例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;
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:24,代碼來源:ChartPanel.java

示例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;
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:24,代碼來源:ChartPanel.java

示例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();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:21,代碼來源:Test6657026.java


注:本文中的javax.swing.ToolTipManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。