Example usage for javax.swing ToolTipManager getDismissDelay

List of usage examples for javax.swing ToolTipManager getDismissDelay

Introduction

In this page you can find the example usage for javax.swing ToolTipManager getDismissDelay.

Prototype

public int getDismissDelay() 

Source Link

Document

Returns the dismissal delay value.

Usage

From source file:net.sf.firemox.Magic.java

public void actionPerformed(ActionEvent e) {
    final String command = e.getActionCommand();
    final Object obj = e.getSource();
    if (obj == sendButton) {
        if (sendTxt.getText().length() != 0) {
            MChat.getInstance().sendMessage(sendTxt.getText() + "\n");
            sendTxt.setText("");
        }/*from   w  w  w.  j ava2 s. c  om*/
    } else if (command != null && command.startsWith("border-")) {
        for (int i = cardBorderMenu.getComponentCount(); i-- > 0;) {
            ((JRadioButtonMenuItem) cardBorderMenu.getComponent(i)).setSelected(false);
        }
        ((JRadioButtonMenuItem) obj).setSelected(true);
        CardFactory.updateColor(command.substring("border-".length()));
        CardFactory.updateAllCardsUI();
        magicForm.repaint();
    } else if ("menu_help_mailing".equals(command)) {
        try {
            WebBrowser.launchBrowser(
                    "http://lists.sourceforge.net/lists/listinfo/" + IdConst.PROJECT_NAME + "-user");
        } catch (Exception e1) {
            JOptionPane.showOptionDialog(this, LanguageManager.getString("error") + " : " + e1.getMessage(),
                    LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE,
                    UIHelper.getIcon("wiz_update_error.gif"), null, null);
        }
    } else if ("menu_options_settings".equals(command)) {
        // Setting panel
        final Wizard settingsPanel = new Settings();
        settingsPanel.setVisible(true);
    } else if ("menu_help_check-update".equals(command)) {
        VersionChecker.checkVersion(this);
    } else if ("menu_game_new_client".equals(command)) {
        new net.sf.firemox.ui.wizard.Client().setVisible(true);
    } else if ("menu_game_new_server".equals(command)) {
        new net.sf.firemox.ui.wizard.Server().setVisible(true);
    } else if ("menu_tools_log".equals(command)) {
        new net.sf.firemox.ui.wizard.Log().setVisible(true);
    } else if ("menu_tools_featurerequest".equals(command)) {
        new Feature().setVisible(true);
    } else if ("menu_tools_bugreport".equals(command)) {
        new Bug().setVisible(true);
    } else if ("menu_game_skip".equals(command)) {
        if (ConnectionManager.isConnected() && skipButton.isEnabled() && StackManager.idHandedPlayer == 0) {
            StackManager.noReplayToken.take();
            try {
                manualSkip();
            } catch (Throwable t) {
                t.printStackTrace();
            } finally {
                StackManager.noReplayToken.release();
            }
        }
    } else if ("menu_game_disconnect".equals(command)) {
        ConnectionManager.closeConnexions();
    } else if ("menu_tools_jdb".equals(command)) {
        DeckBuilder.loadFromMagic();
    } else if ("menu_game_exit".equals(command)) {
        exitForm(null);
    } else if (obj == autoManaMenu) {
        /*
         * invoked you click directly on the "auto-mana option" of the menu
         * "options". The opponent has to know that we are in "auto colorless mana
         * use", since player will no longer click on the mana icon to define
         * which colored mana active player has used as colorless mana, then the
         * opponent have not to wait for active player choice, but apply the same
         * Algorithm calculating which colored manas are used as colorless manas.
         * This information is not sent immediately, but will be sent with the
         * next action of active player.
         */
        MCommonVars.autoMana = autoManaMenu.isSelected();
    } else if (obj == autoPlayMenu) {
        /*
         * invoked you click directly on the "auto-play option" of the menu
         * "options".
         */
        MCommonVars.autoStack = autoPlayMenu.isSelected();
    } else if ("menu_tools_jcb".equals(command)) {
        // TODO cardBuilderMenu -> not yet implemented
        Log.info("cardBuilderMenu -> not yet implemented");
    } else if ("menu_game_proxy".equals(command)) {
        new ProxyConfiguration().setVisible(true);
    } else if ("menu_help_help".equals(command)) {
        /*
         * Invoked you click directly on youLabel. Opponent will receive this
         * information.
         */
        try {
            WebBrowser.launchBrowser("http://prdownloads.sourceforge.net/" + IdConst.PROJECT_NAME
                    + "/7e_rulebook_EN.pdf?download");
        } catch (Exception e1) {
            JOptionPane.showOptionDialog(this, LanguageManager.getString("error") + " : " + e1.getMessage(),
                    LanguageManager.getString("web-pb"), JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE,
                    UIHelper.getIcon("wiz_update_error.gif"), null, null);
        }
    } else if ("menu_help_about".equals(command)) {
        new About(this).setVisible(true);
    } else if ("menu_help_about.tbs".equals(command)) {
        new AboutMdb(this).setVisible(true);
    } else if (obj == reverseArtCheck || obj == reverseSideCheck) {
        Configuration.setProperty("reverseArt", reverseArtCheck.isSelected());
        Configuration.setProperty("reverseSide", reverseSideCheck.isSelected());
        ZoneManager.updateReversed();
        StackManager.PLAYERS[1].updateReversed();
        repaint();
        SwingUtilities.invokeLater(SkinLF.REFRESH_RUNNER);
    } else if (obj == soundMenu) {
        Configuration.setProperty("sound", soundMenu.isSelected());
        soundMenu.setIcon(
                soundMenu.isSelected() ? UIHelper.getIcon("sound.gif") : UIHelper.getIcon("soundoff.gif"));
    } else if ("menu_lf_randomAngle".equals(command)) {
        Configuration.setProperty("randomAngle", ((AbstractButton) e.getSource()).isSelected());
        CardFactory.updateAllCardsUI();
    } else if ("menu_lf_powerToughnessColor".equals(command)) {
        final Color powerToughnessColor = JColorChooser.showDialog(this,
                LanguageManager.getString("menu_lf_powerToughnessColor"), CardFactory.powerToughnessColor);
        if (powerToughnessColor != null) {
            Configuration.setProperty("powerToughnessColor", powerToughnessColor.getRGB());
            CardFactory.updateColor(null);
            repaint();
        }
    } else if (obj == initialdelayMenu) {
        // TODO factor this code with the one of Magic.class
        final ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
        new InputNumber(LanguageManager.getString("initialdelay"),
                LanguageManager.getString("initialdelay.tooltip"), 0, Integer.MAX_VALUE,
                toolTipManager.getInitialDelay()).setVisible(true);
        if (Wizard.optionAnswer == JOptionPane.YES_OPTION) {
            toolTipManager.setEnabled(Wizard.indexAnswer != 0);
            toolTipManager.setInitialDelay(Wizard.indexAnswer);
            initialdelayMenu.setText(LanguageManager.getString("initialdelay")
                    + (toolTipManager.isEnabled() ? " : " + Wizard.indexAnswer + " ms" : "(disabled)"));
            Configuration.setProperty("initialdelay", Wizard.indexAnswer);
        }
    } else if (obj == dismissdelayMenu) {
        // TODO factor this code with the one of Magic.class
        final ToolTipManager toolTipManager = ToolTipManager.sharedInstance();
        new InputNumber(LanguageManager.getString("dismissdelay"),
                LanguageManager.getString("dismissdelay.tooltip"), 0, Integer.MAX_VALUE,
                toolTipManager.getDismissDelay()).setVisible(true);
        if (Wizard.optionAnswer == JOptionPane.YES_OPTION) {
            toolTipManager.setDismissDelay(Wizard.indexAnswer);
            Configuration.setProperty("dismissdelay", Wizard.indexAnswer);
            dismissdelayMenu.setText(LanguageManager.getString("dismissdelay") + Wizard.indexAnswer + " ms");
        }
    }

}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Constructs a JFreeChart panel.//from   w w w. jav  a2  s  .c o m
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 */
public TraceViewChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) {

    this.setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom) {
        this.popup = createPopupMenu(properties, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();
}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * Constructs a JFreeChart panel.//from  w ww.  j  a  va  2  s .  c  o  m
 *
 * @param chart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawWidth  the minimum drawing width.
 * @param minimumDrawHeight  the minimum drawing height.
 * @param maximumDrawWidth  the maximum drawing width.
 * @param maximumDrawHeight  the maximum drawing height.
 * @param useBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be
 *                  enabled for the chart.
 */
public ChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) {

    this.setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom) {
        this.popup = createPopupMenu(properties, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;

    this.rangeHistory = new Stack<Range>();
}

From source file:com.isti.traceview.common.TraceViewChartPanel.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.
 * /* w  ww  .j  a  v a 2s.c om*/
 * @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;
    }
}

From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java

/**
 * Constructs a JFreeChart panel./*from  w w w . j a  va 2 s  . c  o  m*/
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param copy
 *            a flag indicating whether or not a copy option should be available via the popup
 *            menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 * 
 * @since 1.0.13
 */
public AbstractChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean copy,
        boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(chart, width, height, minimumDrawWidth, minimumDrawHeight, maximumDrawWidth, maximumDrawHeight, false,
            properties, copy, save, print, zoom, tooltips);
    setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));

    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || copy || save || print || zoom) {
        this.popup = createPopupMenu(properties, copy, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    // mouse listener registered in super class
    // addMouseListener(this);
    // addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;
    this.selectionOutlinePaint = Color.blue;
    this.selectionFillPaint = new Color(0, 0, 255, 63);

    this.panMask = InputEvent.CTRL_MASK;
    // for MacOSX we can't use the CTRL key for mouse drags, see:
    // http://developer.apple.com/qa/qa2004/qa1362.html
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.startsWith("mac os x")) {
        this.panMask = InputEvent.ALT_MASK;
    }

    this.overlays = new java.util.ArrayList<>();

    // adding wheel listener
    addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                return;
            }
            if (e.getWheelRotation() < 0) {
                shrinkSelectionOnCenter(e.getX(), e.getY(), e);
            } else {
                enlargeSelectionOnCenter(e.getX(), e.getY(), e);
            }
        }
    });
}

From source file:com.rapidminer.gui.plotter.charts.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.
 * //from ww w  .j  a  v  a 2  s .  com
 * @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;
    }
}