List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:com.jmstoolkit.queuebrowser.QueueBrowserView.java
private void destinationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_destinationComboBoxActionPerformed try {//w w w . j a va 2 s. c o m String selectedItem = destinationComboBox.getSelectedItem().toString().trim(); this.jmsTemplate.setDefaultDestination((Destination) this.jndiTemplate.lookup(selectedItem)); if (evt.getActionCommand().equals("comboBoxEdited") && (!destinationList.contains(selectedItem))) { destinationList = Settings.addSetting(appProperties, P_DESTINATIONS, selectedItem); destinationComboBox.addItem(selectedItem); } } catch (NamingException ex) { messageTextArea.setText(JTKException.formatException(ex)); } }
From source file:com.jmstoolkit.queuebrowser.QueueBrowserView.java
private void connectionFactoryComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectionFactoryComboBoxActionPerformed try {//w w w . j a va 2 s. co m String selectedItem = connectionFactoryComboBox.getSelectedItem().toString().trim(); connectionFactory.setTargetConnectionFactory(wrapConnectionFactory(selectedItem)); if (evt.getActionCommand().equals("comboBoxEdited") && (!connectionFactoryList.contains(selectedItem))) { connectionFactoryList = Settings.addSetting(appProperties, P_CONNECTION_FACTORIES, selectedItem); connectionFactoryComboBox.addItem(selectedItem); } } catch (NamingException ex) { messageTextArea.setText(JTKException.formatException(ex)); } }
From source file:org.gumtree.vis.awt.time.TimePlotPanel.java
@Override public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (command.equals(LEGEND_NONE_COMMAND)) { getChart().getLegend().setVisible(false); // repaint(); } else if (command.equals(LEGEND_BOTTOM_COMMAND)) { getChart().getLegend().setVisible(true); getChart().getLegend().setPosition(RectangleEdge.BOTTOM); // repaint(); } else if (command.startsWith(LEGEND_RIGHT_COMMAND)) { getChart().getLegend().setVisible(true); getChart().getLegend().setPosition(RectangleEdge.RIGHT); // repaint(); } else if (command.equals(UNFOCUS_CURVE_COMMAND)) { selectSeries(null, -1);// w w w . j a va2 s .c o m // repaint(); } else if (command.startsWith(FOCUS_ON_COMMAND)) { String[] commands = command.split("-", 2); if (commands.length > 1) { selectSeries(commands[1]); // repaint(); } } else if (command.equals(RESET_ALL_CURVE_COMMAND)) { clear(); } else if (command.startsWith(RESET_CURVE_COMMAND)) { String[] commands = command.split("-", 2); if (commands.length > 1) { clearSeries(commands[1]); } } else if (command.equals(SHOW_MULTI_AXES_COMMAND)) { setShowMultiaxes(showMultiAxesMenuItem.isSelected()); updateUI(); } else if (command.equals(TOGGLE_PAUSED_COMMAND)) { setPaused(!isPaused); } else { super.actionPerformed(event); } updatePlot(); }
From source file:AltiConsole.AltiConsoleMainScreen.java
/** * Handles all the actions./* w ww .j av a 2s . c o m*/ * * @param e * the action event. */ public void actionPerformed(final ActionEvent e) { final Translator trans = Application.getTranslator(); if (e.getActionCommand().equals("EXIT")) { System.out.println("exit and disconnecting\n"); if (JOptionPane.showConfirmDialog(this, trans.get("AltiConsoleMainScreen.ClosingWindow"), trans.get("AltiConsoleMainScreen.ReallyClosing"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { DisconnectFromAlti(); System.exit(0); } } else if (e.getActionCommand().equals("ABOUT")) { AboutDialog.showPreferences(AltiConsoleMainScreen.this); } // ERASE_FLIGHT else if (e.getActionCommand().equals("ERASE_FLIGHT")) { if (JOptionPane.showConfirmDialog(this, trans.get("AltiConsoleMainScreen.eraseAllflightData"), trans.get("AltiConsoleMainScreen.eraseAllflightDataTitle"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { System.out.println("erasing flight\n"); ErasingFlight(); } } else if (e.getActionCommand().equals("RETRIEVE_FLIGHT")) { System.out.println("retrieving flight\n"); RetrievingFlight(); } else // SAVE_FLIGHT if (e.getActionCommand().equals("SAVE_FLIGHT")) { System.out.println("Saving current flight\n"); SavingFlight(); } else // RETRIEVE_ALTI_CFG if (e.getActionCommand().equals("RETRIEVE_ALTI_CFG")) { System.out.println("retrieving alti config\n"); AltiConfigData pAlticonfig = retrieveAltiConfig(); if (pAlticonfig != null) AltiConfigDlg.showPreferences(AltiConsoleMainScreen.this, pAlticonfig, Serial); } // LICENSE else if (e.getActionCommand().equals("LICENSE")) { LicenseDialog.showPreferences(AltiConsoleMainScreen.this); } // comPorts else if (e.getActionCommand().equals("comPorts")) { DisconnectFromAlti(); String currentPort; //e. currentPort = (String) comPorts.getSelectedItem(); if (Serial != null) Serial.searchForPorts(); System.out.println("We have a new selected value for comport\n"); comPorts.setSelectedItem(currentPort); } // UPLOAD_FIRMWARE else if (e.getActionCommand().equals("UPLOAD_FIRMWARE")) { System.out.println("upload firmware\n"); //make sure to disconnect first DisconnectFromAlti(); JFileChooser fc = new JFileChooser(); String hexfile = null; File startFile = new File(System.getProperty("user.dir")); //FileNameExtensionFilter filter; fc.setDialogTitle("Select firmware"); //fc.set fc.setCurrentDirectory(startFile); //fc.addChoosableFileFilter(new FileNameExtensionFilter("*.HEX", "hex")); fc.setFileFilter(new FileNameExtensionFilter("*.hex", "hex")); //fc.fil int action = fc.showOpenDialog(SwingUtilities.windowForComponent(this)); if (action == JFileChooser.APPROVE_OPTION) { hexfile = fc.getSelectedFile().getAbsolutePath(); } if (hexfile != null) { String exefile = UserPref.getAvrdudePath(); String conffile = UserPref.getAvrdudeConfigPath(); String opts = " -v -v -v -v -patmega328p -carduino -P\\\\.\\" + (String) this.comPorts.getSelectedItem() + " -b115200 -D -V "; String cmd = exefile + " -C" + conffile + opts + " -Uflash:w:" + hexfile + ":i"; System.out.println(cmd); try { Process p = Runtime.getRuntime().exec(cmd); AfficheurFlux fluxSortie = new AfficheurFlux(p.getInputStream(), this); AfficheurFlux fluxErreur = new AfficheurFlux(p.getErrorStream(), this); new Thread(fluxSortie).start(); new Thread(fluxErreur).start(); p.waitFor(); } catch (IOException e1) { e1.printStackTrace(); } catch (InterruptedException e2) { e2.printStackTrace(); } } } // ON_LINE_HELP else if (e.getActionCommand().equals("ON_LINE_HELP")) { Desktop d = Desktop.getDesktop(); System.out.println("Online help \n"); try { d.browse(new URI(trans.get("help.url"))); } catch (URISyntaxException e1) { System.out.println("Illegal URL: " + trans.get("help.url") + " " + e1.getMessage()); } catch (IOException e1) { System.out.println("Unable to launch browser: " + e1.getMessage()); } } }
From source file:de.tor.tribes.ui.views.DSWorkbenchSelectionFrame.java
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Copy")) { copySelectionToInternalClipboard(); } else if (e.getActionCommand().equals("BBCopy")) { copyBBToExternalClipboardEvent(); } else if (e.getActionCommand().equals("Cut")) { cutSelectionToInternalClipboard(); } else if (e.getActionCommand().equals("Paste")) { pasteFromInternalClipboard();//from w w w .ja va 2 s .co m } else if (e.getActionCommand().equals("Delete")) { removeSelection(); } }
From source file:org.jfree.chart.demo.SuperDemo.java
public void actionPerformed(ActionEvent actionevent) { String s = actionevent.getActionCommand(); if (s.equals("EXPORT_TO_PDF")) exportToPDF();/*from ww w . j a v a 2 s .c o m*/ else if (s.equals("EXIT")) attemptExit(); }
From source file:edu.harvard.mcz.imagecapture.ImageDisplayFrame.java
/** * This method initializes jComboBoxImagePicker * //from w ww .j a v a2 s .c o m * @return javax.swing.JComboBox */ private JComboBox getJComboBoxImagePicker() { if (jComboBoxImagePicker == null) { jComboBoxImagePicker = new JComboBox(); if (targetSpecimen != null) { Iterator<ICImage> i = targetSpecimen.getICImages().iterator(); while (i.hasNext()) { String filename = i.next().getFilename(); jComboBoxImagePicker.addItem(filename); log.debug(filename); } } jComboBoxImagePicker.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { // Intended to be fired when picklist item is selected, is // being fired on other events as well. log.debug(e.getActionCommand()); // If there is no selection, then we shouldn't be doing anything. if (jComboBoxImagePicker.getSelectedItem() == null) { log.debug("No selected item"); } else { ICImage pattern = new ICImage(); try { boolean hasParameter = false; if (jComboBoxImagePicker.getSelectedItem() != null) { pattern.setFilename(jComboBoxImagePicker.getSelectedItem().toString()); hasParameter = true; log.debug("Parameter: " + jComboBoxImagePicker.getSelectedItem().toString()); } if (targetSpecimen != null) { pattern.setSpecimen(targetSpecimen); hasParameter = true; log.debug("Parameter: " + targetSpecimen.getBarcode()); } if (hasParameter) { // find matching images, set first one as the display image. ICImageLifeCycle ils = new ICImageLifeCycle(); List<ICImage> images = ils.findByExample(pattern); if (images != null && images.size() > 0) { log.debug("Found: " + images.size()); Iterator<ICImage> ii = images.iterator(); boolean found = false; while (ii.hasNext() && !found) { ICImage image = ii.next(); if (image.getSpecimen() != null && !image.getSpecimen().getBarcode() .equals(targetSpecimen.getBarcode())) { // same filename, but wrong path. log.debug("WrongFile: " + image.getPath()); } else { found = true; //String startPointName = Singleton.getSingletonInstance().getProperties().getProperties().getProperty(ImageCaptureProperties.KEY_IMAGEBASE); String path = image.getPath(); if (path == null) { path = ""; } File fileToCheck = new File(ImageCaptureProperties .assemblePathWithBase(path, image.getFilename())); PositionTemplate defaultTemplate; try { defaultTemplate = PositionTemplate.findTemplateForImage(image); loadImagesFromFileSingle(fileToCheck, defaultTemplate, image); } catch (ImageLoadException e3) { log.error(e3); } catch (BadTemplateException e1) { log.error(e1); } } } } } } catch (NullPointerException e2) { // Probably means an empty jComboBoxImagePicker e2.printStackTrace(); log.error(e2.getMessage(), e2); } } } }); } return jComboBoxImagePicker; }
From source file:org.eevolution.form.VCRP.java
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { Timestamp date = (Timestamp) dateFrom.getValue(); int S_Resource_ID = ((Integer) resource.getValue()).intValue(); System.out.println("ConfirmPanel.A_OK"); System.out.println("date" + date + " S_Resource_ID " + S_Resource_ID); if (date != null && S_Resource_ID != 0) { System.out.println("Call createDataset(date,S_Resource_ID)"); MResource r = new MResource(Env.getCtx(), S_Resource_ID, null); // Gendert Anfang 04.08.2005 int uom_id = r.getResourceType().getC_UOM_ID(); MUOM uom = new MUOM(Env.getCtx(), uom_id, null); CategoryDataset dataset = null; if (uom.isHour()) { System.out.println("\n ->is Hour<- \n"); dataset = createDataset(date, r); } else { System.out.println("\n ->is not Hour<- \n"); dataset = createWeightDataset(date, r); }/* w ww .j a v a2 s .c o m*/ // Gendert Ende 04.08.2005 //CategoryDataset dataset = createDataset(); System.out.println("dataset.getRowCount:" + dataset.getRowCount()); String title = r.getName() != null ? r.getName() : ""; title = title + " " + r.getDescription() != null ? r.getDescription() : ""; JFreeChart jfreechart = createChart(dataset, title, uom); centerPanel.removeAll(); chartPanel = new ChartPanel(jfreechart, false); centerPanel.add(chartPanel, BorderLayout.CENTER); centerPanel.setVisible(true); m_frame.pack(); } } if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) { dispose(); } }
From source file:cpsd.ImageGUI.java
private void SobelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SobelButtonActionPerformed radio = evt.getActionCommand(); // TODO add your handling code here: }
From source file:cpsd.ImageGUI.java
private void KirschButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_KirschButtonActionPerformed radio = evt.getActionCommand(); // TODO add your handling code here: }