Java 类javax.swing.ToolTipManager 实例源码

项目:incubator-netbeans    文件:Outline.java   
@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();
    }
}
项目:incubator-netbeans    文件:AbstractViewTabDisplayerUI.java   
@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;
}
项目:incubator-netbeans    文件:TooltipHack.java   
/** 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();
}
项目:incubator-netbeans    文件:TooltipHack.java   
/** 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();
}
项目:incubator-netbeans    文件:ComponentDetailsProvider.java   
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();
}
项目:rapidminer    文件:AbstractChartPanel.java   
/**
 * 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;
    }
}
项目:JavaGraph    文件:ConfigDialog.java   
/**
 * 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;
}
项目:JavaGraph    文件:Simulator.java   
/**
 * 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;
}
项目:JavaGraph    文件:StateTree.java   
/**
 * 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);
}
项目:gate-core    文件:MainFrame.java   
@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();
}
项目:powertext    文件:IconRowHeader.java   
@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);

}
项目:powertext    文件:ParserManager.java   
/**
 * 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();
        }
    }
}
项目:MonkeyCrypt    文件:MoCr_SettingsAL.java   
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();
        }
    }
}
项目:parabuild-ci    文件:ChartPanel.java   
/**
 * 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;
    }
}
项目:parabuild-ci    文件:ChartPanel.java   
/**
 * 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;
    }
}
项目:jdk8u-jdk    文件:Test6657026.java   
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();
}
项目:openvisualtraceroute    文件:MainPanel.java   
/**
 * Init the component
 */
private void init() {
    if (!Env.INSTANCE.isOpenGLAvailable()) {
        LOGGER.warn("No graphic card that supports required OpenGL features has been detected. The 3D map will be not be available");
    }
    ToolTipManager.sharedInstance().setInitialDelay(0);
    // init panels
    _statusPanel = new StatusPanel(_services);
    _replayPanel = new ReplayPanel(_services, _statusPanel);
    _controlPanel = new ControlPanel(_services, this, _replayPanel, Env.INSTANCE.isIs3dMap(), Env.INSTANCE.getMode());

    _split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    _rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    _rightPanel = new JPanel(new BorderLayout());
    _rightPanel.add(_rightSplit, BorderLayout.CENTER);
    _rightPanel.add(_statusPanel, BorderLayout.SOUTH);
    _split.setRightComponent(_rightPanel);
    createRightView();
    createMap(false);
    add(_split, BorderLayout.CENTER);

    // add header
    add(_controlPanel, BorderLayout.NORTH);
    resizeSplit();
}
项目:openjdk-jdk10    文件:Test6657026.java   
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();
}
项目:openjdk9    文件:Test6657026.java   
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();
}
项目:ccu-historian    文件:ChartPanel.java   
/**
 * 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;
    }
}
项目:jfreechart    文件:ChartPanel.java   
/**
 * 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;
    }
}
项目:Command-Generator    文件:CommandGenerator.java   
public static void main(String[] args)
{
    if (args.length == 1 && args[0].equals("true")) Settings.testMode = true;
    log("Welcome to the Command Generator v" + Settings.GENERATOR_VERSION + " by Cubi !");
    FileUtils.renameUpdater();
    if (!Settings.testMode) FileUtils.checkForUpdates();
    Settings.loadSettings();
    if (Settings.testMode) Lang.checkTranslations();
    log("---- Creating window ----");
    stateManager = new StateManager();
    window = new Window();
    ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
    ToolTipManager.sharedInstance().setInitialDelay(200);
    window.updateTranslations();
    setSelected(Commands.getCommands()[0]);
    window.setVisible(true);
    if (!Settings.getSetting(Settings.LAST_VERSION).equals(Settings.GENERATOR_VERSION)) showChangelog();
}
项目:scelight    文件:LGlobalSettingChangeListener.java   
@Override
public void valuesChanged( final ISettingChangeEvent event ) {
    if ( event.affected( LSettings.TOOL_TIP_INITIAL_DELAY ) )
        ToolTipManager.sharedInstance().setInitialDelay( event.get( LSettings.TOOL_TIP_INITIAL_DELAY ) );

    if ( event.affected( LSettings.TOOL_TIP_DISMISS_DELAY ) )
        ToolTipManager.sharedInstance().setDismissDelay( event.get( LSettings.TOOL_TIP_DISMISS_DELAY ) );

    if ( event.affected( LSettings.LOG_LEVEL ) )
        LEnv.LOGGER.setLogLevel( event.get( LSettings.LOG_LEVEL ) );

    if ( event.affectedAny( LSettings.ENABLE_NETWORK_PROXY, LSettings.HTTP_PROXY_HOST, LSettings.HTTP_PROXY_PORT, LSettings.HTTPS_PROXY_HOST,
            LSettings.HTTPS_PROXY_PORT, LSettings.SOCKS_PROXY_HOST, LSettings.SOCKS_PROXY_PORT ) ) {
        applyProxyConfig( event );
    }
}
项目:scelight    文件:IndicatorTextField.java   
/**
 * Creates a new {@link IndicatorTextField}.
 * 
 * @param text initial text to be set
 */
public IndicatorTextField( final String text ) {
    // Create a text field which shows the complete path in the tool tip.
    textField = new XTextField() {
        // Register this at the Tool tip manager.
        // Simply calling setToolTipText( "" ) does not work because my getToolTipText() always returns a non-null text,
        // and setToolTipText( "" ) only registers at the tool tip manager if previous tool tip is not null!
        {
            ToolTipManager.sharedInstance().registerComponent( this );
        }

        @Override
        public String getToolTipText() {
            return getText().isEmpty() ? null : getText();
        }
    };

    if ( text != null )
        textField.setText( text );
    addCenter( textField );
}
项目:aya-lang    文件:ChartPanel.java   
/**
 * 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;
    }
}
项目:ftc    文件:IconRowHeader.java   
@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);

}
项目:ftc    文件:ParserManager.java   
/**
 * 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();
        }
    }
}
项目:jdk8u_jdk    文件:Test6657026.java   
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();
}
项目:lookaside_java-1.8.0-openjdk    文件:Test6657026.java   
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();
}
项目:SweetHome3D    文件:SwingTools.java   
/**
 * Returns a scroll bar adjustment listener bound to the given <code>scrollPane</code> view
 * that updates view tool tip when its vertical scroll bar is adjusted.
 */
public static AdjustmentListener createAdjustmentListenerUpdatingScrollPaneViewToolTip(final JScrollPane scrollPane)
{
    return new AdjustmentListener()
    {
        public void adjustmentValueChanged(AdjustmentEvent ev)
        {
            Point screenLocation = MouseInfo.getPointerInfo().getLocation();
            Point point = new Point(screenLocation);
            Component view = scrollPane.getViewport().getView();
            SwingUtilities.convertPointFromScreen(point, view);
            if (scrollPane.isShowing() && scrollPane.getViewport().getViewRect().contains(point))
            {
                MouseEvent mouseEvent = new MouseEvent(view, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0,
                        point.x, point.y, 0, false, MouseEvent.NOBUTTON);
                if (isToolTipShowing())
                {
                    ToolTipManager.sharedInstance().mouseMoved(mouseEvent);
                }
            }
        }
    };
}
项目:SproutLife    文件:PanelController.java   
private void initComponents() {
    ToolTipManager.sharedInstance().setInitialDelay(0);
    gameFrame.setVisible(true);  
    getBoardRenderer().setDefaultBlockSize(3);
    updateZoomValue(-3);
    getMainControlPanel().getZoomSlider().setValue(-3);        
    updateBoardSizeFromPanelSize(getScrollPanel().getViewportSize());
    getImageManager().setBackgroundColor(new Color(160,160,160)); 

    initSettingsControlPanel();              

    initSeedTypeComboBox();

    initStatsPanel();

    loadTipText();               
}
项目:root4j    文件:StreamerInfoBrowser.java   
/** Creates new StreamerInfoBrowser */
public StreamerInfoBrowser(List streamerInfo)
{
   super(new BorderLayout());
   tree = new JTree(new StreamerInfoTreeModel(streamerInfo));
   tree.setCellRenderer(new StreamerInfoTreeCellRenderer());
   tree.addTreeSelectionListener(this);
   tree.setRootVisible(false);
   tree.setShowsRootHandles(true);

   objTree = new JTree(emptyTree);
   objTree.setCellRenderer(new RootObjectTreeCellRenderer());
   ToolTipManager.sharedInstance().registerComponent(objTree);

   JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tree), new JScrollPane(objTree));
   add(split, BorderLayout.CENTER);

   setPreferredSize(new java.awt.Dimension(500, 300));
   split.setDividerLocation(245);

   ToolTipManager.sharedInstance().setEnabled(true);
}
项目:repo.kmeanspp.silhouette_score    文件:BoundaryPanel.java   
/**
 * Creates a new <code>BoundaryPanel</code> instance.
 * 
 * @param panelWidth the width in pixels of the panel
 * @param panelHeight the height in pixels of the panel
 */
public BoundaryPanel(int panelWidth, int panelHeight) {
  ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
  m_panelWidth = panelWidth;
  m_panelHeight = panelHeight;
  setLayout(new BorderLayout());
  m_plotPanel.setMinimumSize(new Dimension(m_panelWidth, m_panelHeight));
  m_plotPanel.setPreferredSize(new Dimension(m_panelWidth, m_panelHeight));
  m_plotPanel.setMaximumSize(new Dimension(m_panelWidth, m_panelHeight));
  add(m_plotPanel, BorderLayout.CENTER);
  setPreferredSize(m_plotPanel.getPreferredSize());
  setMaximumSize(m_plotPanel.getMaximumSize());
  setMinimumSize(m_plotPanel.getMinimumSize());

  m_random = new Random(1);
  for (Color element : DEFAULT_COLORS) {
    m_Colors.add(new Color(element.getRed(), element.getGreen(), element
      .getBlue()));
  }
  m_probabilityCache = new double[m_panelHeight][m_panelWidth][];

}
项目:rapidminer-studio    文件:AbstractChartPanel.java   
/**
 * 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;
    }
}
项目:bigtable-sql    文件:Application.java   
private void preferencesHaveChanged(PropertyChangeEvent evt)
{
    final String propName = evt != null ? evt.getPropertyName() : null;

    if (propName == null || propName.equals(SquirrelPreferences.IPropertyNames.SHOW_TOOLTIPS))
    {
        ToolTipManager.sharedInstance().setEnabled(_prefs.getShowToolTips());
    }

    if (propName == null || propName.equals(SquirrelPreferences.IPropertyNames.JDBC_DEBUG_TYPE))
    {
        setupJDBCLogging();
    }

    if (propName == null || propName.equals(SquirrelPreferences.IPropertyNames.LOGIN_TIMEOUT))
    {
        DriverManager.setLoginTimeout(_prefs.getLoginTimeout());
    }

    if (propName == null || propName == SquirrelPreferences.IPropertyNames.PROXY)
    {
        new ProxyHandler().apply(_prefs.getProxySettings());
    }
}
项目:Tank    文件:ParserManager.java   
/**
 * 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();
        }
    }
}
项目:swing    文件:ReturnsSummaryTable.java   
@PostConstruct
protected void build() {
    ToolTipManager.sharedInstance().unregisterComponent(this);
    addKeyListener(new SelectedReturnKeyListener());
    addMouseListener(new SelectedReturnMouseListener());
    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    setCellSelectionEnabled(true);
    setColumnSelectionAllowed(true);
    setRowSelectionAllowed(true); 
    setAutoCreateColumnsFromModel(false);
    setAutoCreateRowSorter(false);
    setFillsViewportHeight(true);
    setEditable(false);
    addHighlighter(HighlighterFactory.createAlternateStriping(Color.white, Colors.tableRowColor));
    addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.blue));
    addHighlighter(NegativeNumberHighlighter.instance);
}
项目:Tank    文件:ParserManager.java   
/**
 * 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();
        }
    }
}
项目:incubator-taverna-plugin-bioinformatics    文件:BiomobyObjectTree.java   
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
        boolean sel, boolean expanded, boolean leaf, int row,
        boolean hasFocus) {
    if (value instanceof DefaultMutableTreeNode) {
        if (((DefaultMutableTreeNode) value).getUserObject() instanceof BiomobyDatatypeDescription) {
            BiomobyDatatypeDescription desc = (BiomobyDatatypeDescription) ((DefaultMutableTreeNode) value)
                    .getUserObject();
            String d = desc.getDescription().trim();
            // we only keep MAX_TOOLTIP_LENGTH characters of the string
            if (d.length() > MAX_TOOLTIP_LENGTH)
                d = d.substring(0, MAX_TOOLTIP_LENGTH) + "...";
            setToolTipText("<html><body><div style='width:200px;'><span>"
                    + d + "</span></div></body></html>");

            ToolTipManager.sharedInstance().setDismissDelay(
                    Integer.MAX_VALUE);
        }
    }
    return super.getTreeCellRendererComponent(tree, value, sel,
            expanded, leaf, row, hasFocus);
}
项目:PasswordSafe    文件:AgToolTipUI.java   
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
}