List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:ca.sfu.federation.viewer.propertysheet.PlanePropertySheet.java
private void jcbUpdateMethodActionListener(java.awt.event.ActionEvent evt) { String command = evt.getActionCommand(); logger.log(Level.INFO, "ComponentSheet jcbUpdateMethodActionListener fired {0}", command); try {/*from w w w.ja va 2 s . c o m*/ this.target.setUpdateMethod(evt.getActionCommand()); // update the input arguments panel } catch (Exception ex) { String stack = ExceptionUtils.getFullStackTrace(ex); logger.log(Level.WARNING, "{0}", stack); } }
From source file:regresiones.RegresionMultiple.java
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("calcular")) {//podemos comparar por el contenido del boton String sx1 = this.cajaVariableX1.getText(); String sx2 = this.cajaVariableX2.getText(); prediccionEfect = Double.parseDouble(this.combo.getSelectedItem() + ""); if (isDouble(sx1) && isDouble(sx2)) { prediccionX1 = Double.parseDouble(sx1); prediccionX2 = Double.parseDouble(sx2); Integer gradosLibertad = N - 3; TDistribution td = new TDistribution(gradosLibertad); Double distribucionT = td.inverseCumulativeProbability(((100.0 - prediccionEfect) / 2.0) / 100.0) * -1.0;/*from www .j av a 2s . c o m*/ prediccionYestimada = b0 + b1 * prediccionX1 + b2 * prediccionX2; prediccionLi = prediccionYestimada - distribucionT * Se; prediccionLs = prediccionYestimada + distribucionT * Se; String[] titulos2 = { "Y estimada", "Li", "Ls" };//los titulos de la tabla String[][] pruebaIntervalos = { { prediccionYestimada + "", prediccionLi + "", prediccionLs + "" } }; DefaultTableModel TableModel = new DefaultTableModel(pruebaIntervalos, titulos2); jtable2.setModel(TableModel); } else { JOptionPane.showMessageDialog(null, "Valores no validos."); } System.out.println("imprimir" + e.getActionCommand()); } if (e.getActionCommand().equals("Exportar a PDF")) { try { String nombrePDF = JOptionPane.showInputDialog("Escribe el nombre del PDF (sin extension)"); Double[] prediccionValores = { prediccionX1, prediccionX2, prediccionEfect, prediccionYestimada, prediccionLi, prediccionLs }; PDFmultiple.crearPDF("Regresion multiple", arregloFinal, nombrePDF, N, b0, b1, b2, Se, prediccionValores); JOptionPane.showMessageDialog(jtable, "Se creo el PDF"); } catch (DocumentException | FileNotFoundException ex) { Logger.getLogger(RegresionMultiple.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:net.sf.mzmine.modules.visualization.tic.TICVisualizerWindow.java
/** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) *//*from w w w.j a v a2 s .co 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("MOVE_CURSOR_LEFT")) { CursorPosition pos = getCursorPosition(); if (pos != null) { TICDataSet dataSet = ticDataSets.get(pos.getDataFile()); int index = dataSet.getIndex(pos.getRetentionTime(), pos.getIntensityValue()); if (index > 0) { index--; pos.setRetentionTime((double) dataSet.getXValue(0, index)); pos.setIntensityValue((double) dataSet.getYValue(0, index)); setCursorPosition(pos); } } } if (command.equals("MOVE_CURSOR_RIGHT")) { CursorPosition pos = getCursorPosition(); if (pos != null) { TICDataSet dataSet = ticDataSets.get(pos.getDataFile()); int index = dataSet.getIndex(pos.getRetentionTime(), pos.getIntensityValue()); if (index >= 0) { index++; if (index < dataSet.getItemCount(0)) { pos.setRetentionTime((double) dataSet.getXValue(0, index)); pos.setIntensityValue((double) dataSet.getYValue(0, index)); setCursorPosition(pos); } } } } }
From source file:com.floreantpos.ui.dialog.PasswordEntryDialog.java
public void actionPerformed(ActionEvent e) { String actionCommand = e.getActionCommand(); if (POSConstants.CANCEL.equalsIgnoreCase(actionCommand)) { doCancel();/*from w w w.jav a 2 s.c o m*/ } else if (POSConstants.OK.equalsIgnoreCase(actionCommand)) { doOk(); } else { if (StringUtils.isNotEmpty(actionCommand)) { tfPassword.setText(getPasswordAsString() + actionCommand); } } }
From source file:net.sf.mzmine.modules.visualization.ida.IDAPlot.java
@Override public void actionPerformed(final ActionEvent event) { super.actionPerformed(event); final String command = event.getActionCommand(); if ("SAVE_EMF".equals(command)) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("EMF Image", "EMF"); chooser.setFileFilter(filter);/*from w w w . j a v a 2 s. co m*/ int returnVal = chooser.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { String file = chooser.getSelectedFile().getPath(); if (!file.toLowerCase().endsWith(".emf")) file += ".emf"; int width = (int) this.getSize().getWidth(); int height = (int) this.getSize().getHeight(); // Save image SaveImage SI = new SaveImage(getChart(), file, width, height, FileType.EMF); new Thread(SI).start(); } } if ("SAVE_EPS".equals(command)) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("EPS Image", "EPS"); chooser.setFileFilter(filter); int returnVal = chooser.showSaveDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { String file = chooser.getSelectedFile().getPath(); if (!file.toLowerCase().endsWith(".eps")) file += ".eps"; int width = (int) this.getSize().getWidth(); int height = (int) this.getSize().getHeight(); // Save image SaveImage SI = new SaveImage(getChart(), file, width, height, FileType.EPS); new Thread(SI).start(); } } }
From source file:regresiones.RegresionSimple.java
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("calcular")) {//podemos comparar por el contenido del boton String sx1 = this.cajaVariableX1.getText(); prediccionEfect = Double.parseDouble(this.combo.getSelectedItem() + ""); if (isDouble(sx1)) { prediccionX1 = Double.parseDouble(sx1); Integer gradosLibertad = N - 2; TDistribution td = new TDistribution(gradosLibertad); Double distribucionT = td.inverseCumulativeProbability(((100.0 - prediccionEfect) / 2.0) / 100.0) * -1.0;/*from ww w .j av a 2 s. co m*/ prediccionYestimada = b0 + b1 * prediccionX1; prediccionLi = prediccionYestimada - distribucionT * Se; prediccionLs = prediccionYestimada + distribucionT * Se; String[] titulos2 = { "Y estimada", "Li", "Ls" };//los titulos de la tabla String[][] pruebaIntervalos = { { prediccionYestimada + "", prediccionLi + "", prediccionLs + "" } }; DefaultTableModel TableModel = new DefaultTableModel(pruebaIntervalos, titulos2); jtable2.setModel(TableModel); } else { JOptionPane.showMessageDialog(null, "Valores no validos."); } System.out.println("imprimir" + e.getActionCommand()); //comentario } if (e.getActionCommand().equals("Exportar a PDF")) { try { String nombrePDF = JOptionPane.showInputDialog("Escribe el nombre del PDF (sin extension)"); Double[] prediccionValores = { prediccionX1, prediccionEfect, prediccionYestimada, prediccionLi, prediccionLs }; PDFsimple.crearPDF("Regresion simple", arregloFinal, nombrePDF, N, b0, b1, Se, dx, dy, dxy, r, prediccionValores); JOptionPane.showMessageDialog(jtable, "Se creo el PDF"); } catch (DocumentException | FileNotFoundException ex) { Logger.getLogger(RegresionMultiple.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:GenealogyExample.java
/** * Required by the ActionListener interface. Handle events on the * showDescendant and showAncestore buttons. *///from w ww.j ava2 s .c o m public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand() == SHOW_ANCESTOR_CMD) { tree.showAncestor(true); } else { tree.showAncestor(false); } }
From source file:de.tud.kom.p2psim.impl.skynet.visualization.MetricsPlot.java
@Override public void actionPerformed(ActionEvent e) { JRadioButton button = (JRadioButton) e.getSource(); if (button.isSelected()) { if (e.getActionCommand().equals("Min-Values")) { showMin = true;/*from ww w . java2 s. c om*/ } else if (e.getActionCommand().equals("Max-Values")) { showMax = true; } else { showSdtDev = true; } } else { if (e.getActionCommand().equals("Min-Values")) { showMin = false; } else if (e.getActionCommand().equals("Max-Values")) { showMax = false; } else { showSdtDev = false; } } }
From source file:javazoom.jlgui.player.amp.equalizer.ui.EqualizerUI.java
public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); log.debug("Action=" + cmd + " (EDT=" + SwingUtilities.isEventDispatchThread() + ")"); // On/Off/*from w w w.j ava 2 s . co m*/ if (cmd.equals(PlayerActionEvent.ACEQONOFF)) { if (ui.getAcEqOnOff().isSelected()) { config.setEqualizerOn(true); } else { config.setEqualizerOn(false); } synchronizeEqualizer(); } // Auto else if (cmd.equals(PlayerActionEvent.ACEQAUTO)) { if (ui.getAcEqAuto().isSelected()) { config.setEqualizerAuto(true); } else { config.setEqualizerAuto(false); } } // Presets else if (cmd.equals(PlayerActionEvent.ACEQPRESETS)) { if (e.getModifiers() == MouseEvent.BUTTON1_MASK) { mainpopup.show(this, ui.getAcEqPresets().getLocation().x, ui.getAcEqPresets().getLocation().y); } } else if (cmd.equals("Normal")) { updateSliders(PRESET_NORMAL); synchronizeEqualizer(); } else if (cmd.equals("Classical")) { updateSliders(PRESET_CLASSICAL); synchronizeEqualizer(); } else if (cmd.equals("Club")) { updateSliders(PRESET_CLUB); synchronizeEqualizer(); } else if (cmd.equals("Dance")) { updateSliders(PRESET_DANCE); synchronizeEqualizer(); } else if (cmd.equals("Full Bass")) { updateSliders(PRESET_FULLBASS); synchronizeEqualizer(); } else if (cmd.equals("Full Bass & Treble")) { updateSliders(PRESET_FULLBASSTREBLE); synchronizeEqualizer(); } else if (cmd.equals("Full Treble")) { updateSliders(PRESET_FULLTREBLE); synchronizeEqualizer(); } else if (cmd.equals("Laptop")) { updateSliders(PRESET_LAPTOP); synchronizeEqualizer(); } else if (cmd.equals("Live")) { updateSliders(PRESET_LIVE); synchronizeEqualizer(); } else if (cmd.equals("Party")) { updateSliders(PRESET_PARTY); synchronizeEqualizer(); } else if (cmd.equals("Pop")) { updateSliders(PRESET_POP); synchronizeEqualizer(); } else if (cmd.equals("Reggae")) { updateSliders(PRESET_REGGAE); synchronizeEqualizer(); } else if (cmd.equals("Rock")) { updateSliders(PRESET_ROCK); synchronizeEqualizer(); } else if (cmd.equals("Techno")) { updateSliders(PRESET_TECHNO); synchronizeEqualizer(); } }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java
/** * Handles user interaction with the property panel. * //from w w w . j av a 2 s . c om * @param event * information about the event that triggered the call to this * method. */ public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (command.equals("SelectLabelFont")) { attemptLabelFontSelection(); } else if (command.equals("SelectLabelPaint")) { attemptModifyLabelPaint(); } else if (command.equals("SelectTickLabelFont")) { attemptTickLabelFontSelection(); } }