List of usage examples for javax.swing ToolTipManager isEnabled
public boolean isEnabled()
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 . ja va2 s. com } 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"); } } }