List of usage examples for javax.swing ToolTipManager setDismissDelay
public void setDismissDelay(int milliseconds)
From source file:Main.java
public static final void emphasizeToolTip() { ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setDismissDelay(100000); toolTipManager.setInitialDelay(10);//from w w w . ja v a 2 s.c om toolTipManager.setReshowDelay(10); }
From source file:Main.java
void start() { ToolTipManager ttm = ToolTipManager.sharedInstance(); ttm.setInitialDelay(0);/*from w ww .j a v a2 s .c o m*/ ttm.setDismissDelay(10000); Main newContentPane = new Main(); newContentPane.setOpaque(true); JFrame frame = new JFrame("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(newContentPane); frame.pack(); frame.setLocation(150, 150); frame.setVisible(true); }
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 ww. j a va 2s . c o m*/ } 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
/** * Handles a 'mouse exited' event. This method resets the tooltip delays of * ToolTipManager.sharedInstance() to their original values in effect before mouseEntered() * /*from ww w .j a v a 2 s .co m*/ * @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; } }
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. * // www . j a v a 2 s . 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
/** * Handles a 'mouse exited' event. This method resets the tooltip delays of * ToolTipManager.sharedInstance() to their original values in effect before mouseEntered() * //w ww .j a v a 2 s . c o m * @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; } }
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 w ww . jav a 2 s. c o m * @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; } }
From source file:jp.massbank.spectrumsearch.SearchPage.java
/** * ?/*from www.ja v a 2s . c o m*/ */ private void createWindow() { // ?? ToolTipManager ttm = ToolTipManager.sharedInstance(); ttm.setInitialDelay(50); ttm.setDismissDelay(8000); // Search? JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(1, 1, 1, 1)); mainPanel.setBorder(border); // ********************************************************************* // User File Query // ********************************************************************* DefaultTableModel fileDm = new DefaultTableModel(); fileSorter = new TableSorter(fileDm, TABLE_QUERY_FILE); queryFileTable = new JTable(fileSorter) { @Override public boolean isCellEditable(int row, int column) { // super.isCellEditable(row, column); // ?????? return false; } }; queryFileTable.addMouseListener(new TblMouseListener()); fileSorter.setTableHeader(queryFileTable.getTableHeader()); queryFileTable.setRowSelectionAllowed(true); queryFileTable.setColumnSelectionAllowed(false); queryFileTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] col = { COL_LABEL_NO, COL_LABEL_NAME, COL_LABEL_ID }; ((DefaultTableModel) fileSorter.getTableModel()).setColumnIdentifiers(col); (queryFileTable.getColumn(queryFileTable.getColumnName(0))).setPreferredWidth(44); (queryFileTable.getColumn(queryFileTable.getColumnName(1))).setPreferredWidth(LEFT_PANEL_WIDTH - 44); (queryFileTable.getColumn(queryFileTable.getColumnName(2))).setPreferredWidth(70); ListSelectionModel lm = queryFileTable.getSelectionModel(); lm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lm.addListSelectionListener(new LmFileListener()); queryFilePane = new JScrollPane(queryFileTable); queryFilePane.addMouseListener(new PaneMouseListener()); queryFilePane.setPreferredSize(new Dimension(300, 300)); // ********************************************************************* // Result // ********************************************************************* DefaultTableModel resultDm = new DefaultTableModel(); resultSorter = new TableSorter(resultDm, TABLE_RESULT); resultTable = new JTable(resultSorter) { @Override public String getToolTipText(MouseEvent me) { // super.getToolTipText(me); // ????? Point pt = me.getPoint(); int row = rowAtPoint(pt); if (row < 0) { return null; } else { int nameCol = getColumnModel().getColumnIndex(COL_LABEL_NAME); return " " + getValueAt(row, nameCol) + " "; } } @Override public boolean isCellEditable(int row, int column) { // super.isCellEditable(row, column); // ?????? return false; } }; resultTable.addMouseListener(new TblMouseListener()); resultSorter.setTableHeader(resultTable.getTableHeader()); JPanel dbPanel = new JPanel(); dbPanel.setLayout(new BorderLayout()); resultPane = new JScrollPane(resultTable); resultPane.addMouseListener(new PaneMouseListener()); resultTable.setRowSelectionAllowed(true); resultTable.setColumnSelectionAllowed(false); resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] col2 = { COL_LABEL_NAME, COL_LABEL_SCORE, COL_LABEL_HIT, COL_LABEL_ID, COL_LABEL_ION, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO }; resultDm.setColumnIdentifiers(col2); (resultTable.getColumn(resultTable.getColumnName(0))).setPreferredWidth(LEFT_PANEL_WIDTH - 180); (resultTable.getColumn(resultTable.getColumnName(1))).setPreferredWidth(70); (resultTable.getColumn(resultTable.getColumnName(2))).setPreferredWidth(20); (resultTable.getColumn(resultTable.getColumnName(3))).setPreferredWidth(70); (resultTable.getColumn(resultTable.getColumnName(4))).setPreferredWidth(20); (resultTable.getColumn(resultTable.getColumnName(5))).setPreferredWidth(70); (resultTable.getColumn(resultTable.getColumnName(6))).setPreferredWidth(50); ListSelectionModel lm2 = resultTable.getSelectionModel(); lm2.addListSelectionListener(new LmResultListener()); resultPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, 200)); dbPanel.add(resultPane, BorderLayout.CENTER); // ********************************************************************* // DB Query // ********************************************************************* DefaultTableModel dbDm = new DefaultTableModel(); querySorter = new TableSorter(dbDm, TABLE_QUERY_DB); queryDbTable = new JTable(querySorter) { @Override public boolean isCellEditable(int row, int column) { // super.isCellEditable(row, column); // ?????? return false; } }; queryDbTable.addMouseListener(new TblMouseListener()); querySorter.setTableHeader(queryDbTable.getTableHeader()); queryDbPane = new JScrollPane(queryDbTable); queryDbPane.addMouseListener(new PaneMouseListener()); int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight(); queryDbPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, h)); queryDbTable.setRowSelectionAllowed(true); queryDbTable.setColumnSelectionAllowed(false); queryDbTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); String[] col3 = { COL_LABEL_ID, COL_LABEL_NAME, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO }; DefaultTableModel model = (DefaultTableModel) querySorter.getTableModel(); model.setColumnIdentifiers(col3); // queryDbTable.getColumn(queryDbTable.getColumnName(0)).setPreferredWidth(70); queryDbTable.getColumn(queryDbTable.getColumnName(1)).setPreferredWidth(LEFT_PANEL_WIDTH - 70); queryDbTable.getColumn(queryDbTable.getColumnName(2)).setPreferredWidth(70); queryDbTable.getColumn(queryDbTable.getColumnName(3)).setPreferredWidth(50); ListSelectionModel lm3 = queryDbTable.getSelectionModel(); lm3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lm3.addListSelectionListener(new LmQueryDbListener()); // ? JPanel btnPanel = new JPanel(); btnName.addActionListener(new BtnSearchNameListener()); btnAll.addActionListener(new BtnAllListener()); btnPanel.add(btnName); btnPanel.add(btnAll); parentPanel2 = new JPanel(); parentPanel2.setLayout(new BoxLayout(parentPanel2, BoxLayout.PAGE_AXIS)); parentPanel2.add(btnPanel); parentPanel2.add(queryDbPane); // ? JPanel dispModePanel = new JPanel(); isDispSelected = dispSelected.isSelected(); isDispRelated = dispRelated.isSelected(); if (isDispSelected) { resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } else if (isDispRelated) { resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } Object[] retRadio = new Object[] { dispSelected, dispRelated }; for (int i = 0; i < retRadio.length; i++) { ((JRadioButton) retRadio[i]).addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (isDispSelected != dispSelected.isSelected() || isDispRelated != dispRelated.isSelected()) { isDispSelected = dispSelected.isSelected(); isDispRelated = dispRelated.isSelected(); // ?? resultTable.clearSelection(); resultPlot.clear(); compPlot.setPeaks(null, 1); resultPlot.setPeaks(null, 0); setAllPlotAreaRange(); pkgView.initResultRecInfo(); if (isDispSelected) { resultTable.getSelectionModel() .setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } else if (isDispRelated) { resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } } } }); } ButtonGroup disGroup = new ButtonGroup(); disGroup.add(dispSelected); disGroup.add(dispRelated); dispModePanel.add(lbl2); dispModePanel.add(dispSelected); dispModePanel.add(dispRelated); JPanel paramPanel = new JPanel(); paramPanel.add(etcPropertyButton); etcPropertyButton.setMargin(new Insets(0, 10, 0, 10)); etcPropertyButton.addActionListener(new ActionListener() { private ParameterSetWindow ps = null; public void actionPerformed(ActionEvent e) { // ?????????? if (!isSubWindow) { ps = new ParameterSetWindow(getParentFrame()); } else { ps.requestFocus(); } } }); JPanel optionPanel = new JPanel(); optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS)); optionPanel.add(dispModePanel); optionPanel.add(paramPanel); // PackageView????? pkgView = new PackageViewPanel(); pkgView.initAllRecInfo(); queryTabPane.addTab("DB", parentPanel2); queryTabPane.setToolTipTextAt(TAB_ORDER_DB, "Query from DB."); queryTabPane.addTab("File", queryFilePane); queryTabPane.setToolTipTextAt(TAB_ORDER_FILE, "Query from user file."); queryTabPane.setSelectedIndex(TAB_ORDER_DB); queryTabPane.setFocusable(false); queryTabPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { // ? queryPlot.clear(); compPlot.clear(); resultPlot.clear(); queryPlot.setPeaks(null, 0); compPlot.setPeaks(null, 1); resultPlot.setPeaks(null, 0); // PackageView? pkgView.initAllRecInfo(); // DB Hit? if (resultTabPane.getTabCount() > 0) { resultTabPane.setSelectedIndex(0); } DefaultTableModel dataModel = (DefaultTableModel) resultSorter.getTableModel(); dataModel.setRowCount(0); hitLabel.setText(" "); // DB?User File?????? queryTabPane.update(queryTabPane.getGraphics()); if (queryTabPane.getSelectedIndex() == TAB_ORDER_DB) { parentPanel2.update(parentPanel2.getGraphics()); updateSelectQueryTable(queryDbTable); } else if (queryTabPane.getSelectedIndex() == TAB_ORDER_FILE) { queryFilePane.update(queryFilePane.getGraphics()); updateSelectQueryTable(queryFileTable); } } }); // JPanel queryPanel = new JPanel(); queryPanel.setLayout(new BorderLayout()); queryPanel.add(queryTabPane, BorderLayout.CENTER); queryPanel.add(optionPanel, BorderLayout.SOUTH); queryPanel.setMinimumSize(new Dimension(0, 170)); JPanel jtp2Panel = new JPanel(); jtp2Panel.setLayout(new BorderLayout()); jtp2Panel.add(dbPanel, BorderLayout.CENTER); jtp2Panel.add(hitLabel, BorderLayout.SOUTH); jtp2Panel.setMinimumSize(new Dimension(0, 70)); Color colorGreen = new Color(0, 128, 0); hitLabel.setForeground(colorGreen); resultTabPane.addTab("Result", jtp2Panel); resultTabPane.setToolTipTextAt(TAB_RESULT_DB, "Result of DB hit."); resultTabPane.setFocusable(false); queryPlot.setMinimumSize(new Dimension(0, 100)); compPlot.setMinimumSize(new Dimension(0, 120)); resultPlot.setMinimumSize(new Dimension(0, 100)); int height = initAppletHight / 3; JSplitPane jsp_cmp2db = new JSplitPane(JSplitPane.VERTICAL_SPLIT, compPlot, resultPlot); JSplitPane jsp_qry2cmp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPlot, jsp_cmp2db); jsp_cmp2db.setDividerLocation(height); jsp_qry2cmp.setDividerLocation(height - 25); jsp_qry2cmp.setMinimumSize(new Dimension(190, 0)); viewTabPane.addTab("Compare View", jsp_qry2cmp); viewTabPane.addTab("Package View", pkgView); viewTabPane.setToolTipTextAt(TAB_VIEW_COMPARE, "Comparison of query and result spectrum."); viewTabPane.setToolTipTextAt(TAB_VIEW_PACKAGE, "Package comparison of query and result spectrum."); viewTabPane.setSelectedIndex(TAB_VIEW_COMPARE); viewTabPane.setFocusable(false); JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPanel, resultTabPane); jsp.setDividerLocation(310); jsp.setMinimumSize(new Dimension(180, 0)); jsp.setOneTouchExpandable(true); JSplitPane jsp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jsp, viewTabPane); int divideSize = (int) (initAppletWidth * 0.4); divideSize = (divideSize >= 180) ? divideSize : 180; jsp2.setDividerLocation(divideSize); jsp2.setOneTouchExpandable(true); mainPanel.add(jsp2, BorderLayout.CENTER); add(mainPanel); queryPlot.setSearchPage(this); compPlot.setSearchPage(this); resultPlot.setSearchPage(this); setJMenuBar(MenuBarGenerator.generateMenuBar(this)); }
From source file:org.sikuli.ide.SikuliIDE.java
private void initTooltip() { ToolTipManager tm = ToolTipManager.sharedInstance(); tm.setDismissDelay(30000); }