List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultTitleEditor.java
/** * Handles button clicks by passing control to an appropriate handler * method./*from w w w. j a v a2 s . c om*/ * * @param event * the event */ public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (command.equals("SelectFont")) { attemptFontSelection(); } else if (command.equals("SelectPaint")) { attemptPaintSelection(); } else if (command.equals("ShowTitle")) { attemptModifyShowTitle(); } }
From source file:mesquite.zephyr.RAxMLRunnerCIPRes.RAxMLRunnerCIPRes.java
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equalsIgnoreCase("composeRAxMLCommand")) { MultipartEntityBuilder arguments = MultipartEntityBuilder.create(); StringBuffer sb = new StringBuffer(); getArguments(arguments, sb, "fileName", proteinModelField.getText(), dnaModelField.getText(), otherOptionsField.getText(), bootStrapRepsField.getValue(), bootstrapSeed, numRunsField.getValue(), outgroupTaxSetString, null, false); String command = externalProcRunner.getExecutableCommand() + arguments.toString(); commandLabel.setText("This command will be used by CIPRes to run RAxML:"); commandField.setText(command);/*from www.j a v a 2 s. c om*/ } else if (e.getActionCommand().equalsIgnoreCase("clearCommand")) { commandField.setText(""); commandLabel.setText(""); } }
From source file:netcap.JcaptureConfiguration.java
public void actionPerformed(ActionEvent evt) { Command cmd = Command.getCommand(evt.getActionCommand()); switch (cmd) { case WHOLE://from w w w . j a va 2 s . c o m caplenTextField.setText("1514"); caplenTextField.setEnabled(false); break; case HEAD: caplenTextField.setText("68"); caplenTextField.setEnabled(false); break; case OTHER: caplenTextField.setText(""); caplenTextField.setEnabled(true); caplenTextField.requestFocus(); break; case OK: saveConfiguration(); break; case CANCEL: dispose(); break; default: break; } }
From source file:LightBug.java
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); Object source = e.getSource(); if (action == lightNoneString) { System.out.println("light_none"); lightSwitch.setWhichChild(LIGHT_NONE); } else if (action == lightDirectionalString) { System.out.println("light_directional"); lightSwitch.setWhichChild(LIGHT_DIRECTIONAL); } else if (action == lightPointString) { System.out.println("light_point"); lightSwitch.setWhichChild(LIGHT_POINT); } else if (action == lightSpotString) { System.out.println("light_spot"); lightSwitch.setWhichChild(LIGHT_SPOT); }/*w w w . ja va 2 s . c om*/ }
From source file:components.FrameDemo2.java
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); //Handle the New window button. if (CREATE_WINDOW.equals(command)) { showNewWindow();/* w ww. j a va 2 s. com*/ //Handle the first group of radio buttons. } else if (NO_DECORATIONS.equals(command)) { noDecorations = true; JFrame.setDefaultLookAndFeelDecorated(false); } else if (WS_DECORATIONS.equals(command)) { noDecorations = false; JFrame.setDefaultLookAndFeelDecorated(false); } else if (LF_DECORATIONS.equals(command)) { noDecorations = false; JFrame.setDefaultLookAndFeelDecorated(true); //Handle the second group of radio buttons. } else if (DEFAULT_ICON.equals(command)) { specifyIcon = false; } else if (FILE_ICON.equals(command)) { specifyIcon = true; createIcon = false; } else if (PAINT_ICON.equals(command)) { specifyIcon = true; createIcon = true; } }
From source file:com.naval.gui.Gui.java
public void actionPerformed(ActionEvent event) { // Menu action if (event.getActionCommand().equals("Charger")) { chargerPartie();/*w ww .j a v a 2 s . c o m*/ } else if (event.getActionCommand().equals("Creer")) { creerPartie(); } else if (event.getActionCommand().equals("Executer")) { executerTour(); } else if (event.getActionCommand().equals("Sauver")) { sauverPartie(); } // Menu ordres else if (event.getActionCommand().equals("Ajouter")) { //OrdresDialog2.show(this); OrdresTableDialog dia = new OrdresTableDialog(frame, true); dia.setDonnees(partie.navires, partie.ordres, partie.minute); dia.setVisible(true); } else if (event.getActionCommand().equals("Detecter")) { //OrdresDialog2.show(this); VisibleDialog dia = new VisibleDialog(frame, true); dia.setDonnees(partie.navires, partie.visibilite); dia.setVisible(true); } }
From source file:com.game.ui.views.CharachterEditorPanel.java
@Override public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equalsIgnoreCase("dropDown")) { JComboBox comboBox = (JComboBox) ae.getSource(); JPanel panel = (JPanel) comboBox.getParent().getComponent(4); String name = comboBox.getSelectedItem().toString(); for (GameCharacter enemy : GameBean.enemyDetails) { if (enemy.getName().equalsIgnoreCase(name)) { ((JTextField) panel.getComponent(2)).setText(enemy.getName()); ((JTextField) panel.getComponent(4)).setText(enemy.getImagePath()); ((JTextField) panel.getComponent(6)).setText(new Integer(enemy.getHealth()).toString()); ((JTextField) panel.getComponent(8)).setText(new Integer(enemy.getAttackPts()).toString()); ((JTextField) panel.getComponent(10)).setText(new Integer(enemy.getArmor()).toString()); ((JTextField) panel.getComponent(12)).setText(new Integer(enemy.getAttackRange()).toString()); ((JTextField) panel.getComponent(14)).setText(new Integer(enemy.getMovement()).toString()); return; }/*w w w. j a v a2s .c o m*/ } } else { JButton btn = (JButton) ae.getSource(); JPanel panel = (JPanel) btn.getParent(); int indexOfBtn = btn.getAccessibleContext().getAccessibleIndexInParent(); String name = ((JTextField) panel.getComponent(2)).getText(); String image = ((JTextField) panel.getComponent(4)).getText(); String health = ((JTextField) panel.getComponent(6)).getText(); String attackPts = ((JTextField) panel.getComponent(8)).getText(); String armourPts = ((JTextField) panel.getComponent(10)).getText(); String attackRnge = ((JTextField) panel.getComponent(12)).getText(); String movement = ((JTextField) panel.getComponent(14)).getText(); System.out.println("Index : " + indexOfBtn); JLabel message = ((JLabel) this.getComponent(5)); message.setText(""); message.setVisible(false); if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(image) && StringUtils.isNotBlank(health) && StringUtils.isNotBlank(attackPts) && StringUtils.isNotBlank(armourPts) && StringUtils.isNotBlank(attackRnge) && StringUtils.isNotBlank(movement)) { message.setVisible(false); GameCharacter character = new GameCharacter(); character.setName(name); character.setAttackPts(Integer.parseInt(attackPts)); character.setAttackRange(Integer.parseInt(attackRnge)); character.setHealth(Integer.parseInt(health)); character.setImagePath(image); character.setMovement(Integer.parseInt(movement)); character.setArmor(Integer.parseInt(armourPts)); boolean characterAlrdyPresent = false; for (int i = 0; i < GameBean.enemyDetails.size(); i++) { GameCharacter charFromList = GameBean.enemyDetails.get(i); if (charFromList.getName().equalsIgnoreCase(name)) { GameBean.enemyDetails.remove(i); GameBean.enemyDetails.add(i, character); characterAlrdyPresent = true; } } if (!characterAlrdyPresent) { GameBean.enemyDetails.add(character); } try { GameUtils.writeCharactersToXML(GameBean.enemyDetails, Configuration.PATH_FOR_ENEMY_CHARACTERS); message.setText("Saved Successfully.."); message.setVisible(true); if (!characterAlrdyPresent) { comboBox.addItem(name); comboBox.setSelectedItem(name); } TileInformation tileInfo = GameBean.mapInfo.getPathMap().get(location); if (tileInfo == null) { tileInfo = new TileInformation(); } tileInfo.setEnemy(character); GameBean.mapInfo.getPathMap().put(location, tileInfo); chkBox.setSelected(true); this.revalidate(); return; } catch (Exception e) { System.out.println("CharachterEditorPanel : actionPerformed() : Some error occured " + e); e.printStackTrace(); } } else { message.setText("Pls enter all the fields or pls choose a character from the drop down"); message.setVisible(true); this.revalidate(); } } }
From source file:es.emergya.ui.plugins.LayerSelectionDialog.java
@Override public void actionPerformed(ActionEvent e) { String name = e.getActionCommand(); for (LayerElement le : layers) { if (le.name.equals(name)) { if (((JCheckBox) e.getSource()).isSelected()) { enableLayer(le);/*w w w. j a v a 2 s .c o m*/ } else { if (le.layer == null) { for (Layer l : mv.getAllLayers()) { if (l.name.equals(le.name)) { le.layer = l; break; } } } if (le.layer != null) { le.layer.visible = false; } le.active = false; } save(name, le.active); mv.repaint(); } } }
From source file:com.wet.wired.jsr.recorder.JRecorder.java
public void actionPerformed(ActionEvent ev) { if (ev.getActionCommand().equals("start")) { if (startRecording()) { control.setActionCommand("stop"); control.setText("Stop Recording"); player.setEnabled(false);//from ww w . ja va2 s. c o m decorator.recordStarted(); } } else if (ev.getActionCommand().equals("stop")) { stop(); } else if (ev.getActionCommand().equals("player")) { closeRecorder(); Main.getPlayer().init(new String[0]); } }
From source file:net.sf.mzmine.modules.visualization.ida.IDAVisualizerWindow.java
/** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */// w ww . j a va 2 s. c o m public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (command.equals("SHOW_SPECTRUM")) { CursorPosition pos = getCursorPosition(); if (pos != null) { SpectraVisualizerModule.showNewSpectrumWindow(pos.getDataFile(), pos.getScanNumber()); } } if (command.equals("SETUP_AXES")) { AxesSetupDialog dialog = new AxesSetupDialog(this, IDAPlot.getXYPlot()); dialog.setVisible(true); } if (command.equals("SHOW_DATA_POINTS")) { IDAPlot.switchDataPointsVisible(); } if (command.equals("SWITCH_TOOLTIPS")) { if (tooltipMode) { IDAPlot.showPeaksTooltips(false); toolBar.setTooltipButton(false); tooltipMode = false; } else { IDAPlot.showPeaksTooltips(true); toolBar.setTooltipButton(true); tooltipMode = true; } } if (command.equals("FIND_SPECTRA")) { // Parameters final DoubleParameter inputMZ = new DoubleParameter("Ion m/z", "m/z value of ion to search for."); final MZToleranceParameter inputMZTolerance = new MZToleranceParameter(); final DoubleParameter inputIntensity = new DoubleParameter("Min. ion intensity", "Only ions with intensities above this value will be searched for."); final BooleanParameter inputNL = new BooleanParameter("Neutral Loss", "If selected, the ion to be searched for will be a neutral loss ion.\nIn this case, only ions above the min. intensity will be examined.", false); final ComboParameter<Colors> inputColors = new ComboParameter<Colors>("Color", "The color which the data points will be marked with.", Colors.values()); Parameter<?>[] parameters = new Parameter<?>[5]; parameters[0] = inputMZ; parameters[1] = inputMZTolerance; parameters[2] = inputIntensity; parameters[3] = inputNL; parameters[4] = inputColors; final ParameterSet parametersSearch = new SimpleParameterSet(parameters); ExitCode exitCode = parametersSearch.showSetupDialog(this, true); if (exitCode != ExitCode.OK) return; double searchMZ = parametersSearch.getParameter(inputMZ).getValue(); MZTolerance searchMZTolerance = parametersSearch.getParameter(inputMZTolerance).getValue(); double minIntensity = parametersSearch.getParameter(inputIntensity).getValue(); boolean neutralLoss = parametersSearch.getParameter(inputNL).getValue(); Color highligtColor = Color.red; ; if (parametersSearch.getParameter(inputColors).getValue().equals(Colors.green)) { highligtColor = Color.green; } if (parametersSearch.getParameter(inputColors).getValue().equals(Colors.blue)) { highligtColor = Color.blue; } // Find and highlight spectra with specific ion dataset.highlightSpectra(searchMZ, searchMZTolerance, minIntensity, neutralLoss, highligtColor); // Add legend entry LegendItemCollection chartLegend = IDAPlot.getXYPlot().getLegendItems(); chartLegend.add(new LegendItem("Ion: " + searchMZ, "", "MS/MS spectra which contain the " + searchMZ + " ion\nTolerance: " + searchMZTolerance.toString() + "\nMin intensity: " + minIntensity, "", new Ellipse2D.Double(0, 0, 7, 7), highligtColor)); IDAPlot.getXYPlot().setFixedLegendItems(chartLegend); } }