List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:BasicDnD.java
public void actionPerformed(ActionEvent e) { if ("toggleDnD".equals(e.getActionCommand())) { boolean toggle = toggleDnD.isSelected(); textArea.setDragEnabled(toggle); textField.setDragEnabled(toggle); list.setDragEnabled(toggle);//from w w w . ja v a 2s .c o m table.setDragEnabled(toggle); tree.setDragEnabled(toggle); colorChooser.setDragEnabled(toggle); } }
From source file:StandardDialog.java
/** * Handles clicks on the standard buttons. * * @param event the event./*from www. j a v a2s.c o m*/ */ public void actionPerformed(final ActionEvent event) { final String command = event.getActionCommand(); if (command.equals("helpButton")) { // display help information } else if (command.equals("okButton")) { this.cancelled = false; setVisible(false); } else if (command.equals("cancelButton")) { this.cancelled = true; setVisible(false); } }
From source file:org.jfree.demo.DrawStringDemo.java
/** * Receives action events.// ww w . j av a 2 s.co m * * @param event the event. */ public void actionPerformed(final ActionEvent event) { if (event.getActionCommand().equals("fontButton.clicked")) { displayFontDialog(); } if (event.getActionCommand().equals("combo1.changed")) { handleCombo1Change(); } if (event.getActionCommand().equals("combo2.changed")) { handleCombo2Change(); } if (event.getActionCommand().equals("combo3.changed")) { handleCombo3Change(); } }
From source file:de.genvlin.plugins.jfreechart.JFreeChartPluginImpl.java
public void actionPerformed(ActionEvent e) { XYPool pool = (XYPool) MainPool.getDefault().create(XYPool.class); XYInterface xyi;//from w w w . jav a 2s .com String ac = e.getActionCommand(); for (int i = 1; i < selected.length; i++) { xyi = pool.add(selected[0], selected[i]); if (ac == LINEAR_REG) { //make data to function xyi = fit(xyi); } //add the function pool.add(xyi); } if (pool.size() == 0) { Log.log("Nothing to plot??", true); return; } //plot the fitted functions and its data OR: //only the selected XYVectoritnerface (the raw data) plot(pool, pool.getID()); }
From source file:org.jfree.demo.DrawStringDemo.java
/** * Receives action events./*from ww w . ja v a 2s .c om*/ * * @param event the event. */ public void actionPerformed(final ActionEvent event) { if (event.getActionCommand().equals("fontButton.clicked")) { displayFontDialog(); } if (event.getActionCommand().equals("combo1.changed")) { handleCombo1Change(); } if (event.getActionCommand().equals("combo2.changed")) { handleCombo2Change(); } if (event.getActionCommand().equals("combo3.changed")) { handleCombo3Change(); } }
From source file:com.dnsoft.inmobiliaria.controllers.ConsultaCCPropietariosController.java
@Override public void actionPerformed(ActionEvent e) { String comando = e.getActionCommand(); switch (comando) { case "txtBusqueda": buscarPropietarios();//from w ww .j a v a 2s.co m break; case "btnGrafico": muestraGrafico(); break; default: throw new AssertionError(); } }
From source file:com.game.ui.views.WeaponEditorPanel.java
@Override public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equalsIgnoreCase("dropDown")) { JPanel panel = (JPanel) comboBox.getParent().getComponent(4); String name = comboBox.getSelectedItem().toString(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { Weapon weapon = (Weapon) item; if (weapon.getName().equalsIgnoreCase(name)) { ((JTextField) panel.getComponent(2)).setText(name); ((JComboBox) panel.getComponent(4)).setSelectedItem(weapon.getWeaponType()); ((JTextField) panel.getComponent(6)).setText(Integer.toString(weapon.getAttackRange())); ((JTextField) panel.getComponent(8)).setText(Integer.toString(weapon.getAttackPts())); return; }/*from w ww . j a v a 2s . c om*/ } } } else { JButton btn = (JButton) ae.getSource(); JPanel panel = (JPanel) btn.getParent(); String name = ((JTextField) panel.getComponent(2)).getText(); String weaponType = (String) (((JComboBox) panel.getComponent(4)).getSelectedItem()); String attackRnge = ((JTextField) panel.getComponent(6)).getText(); String attackPts = ((JTextField) panel.getComponent(8)).getText(); // JLabel message = ((JLabel) this.getComponent(5)); validationMess.setText(""); validationMess.setVisible(false); if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(weaponType) && StringUtils.isNotBlank(attackRnge) && StringUtils.isNotBlank(attackPts)) { validationMess.setVisible(false); Weapon weapon = new Weapon(); weapon.setName(name); ; weapon.setAttackRange(Integer.parseInt(attackRnge)); weapon.setAttackPts(Integer.parseInt(attackPts)); weapon.setWeaponType(weaponType); boolean weaponAlrdyPresent = false; int position = GameUtils.getPositionOfWeaponItem(name); if (GameBean.weaponDetails == null) { GameBean.weaponDetails = new ArrayList<Item>(); } if (position != -1) { GameBean.weaponDetails.remove(position); } GameBean.weaponDetails.add(weapon); try { GameUtils.writeItemsToXML(GameBean.weaponDetails, Configuration.PATH_FOR_WEAPONS); validationMess.setText("Saved Successfully.."); validationMess.setVisible(true); if (!weaponAlrdyPresent) { comboBox.removeActionListener(this); comboBox.addItem(name); comboBox.setSelectedItem(name); comboBox.addActionListener(this); } TileInformation tileInfo = GameBean.mapInfo.getPathMap().get(location); if (tileInfo == null) { tileInfo = new TileInformation(); } tileInfo.setWeapon(weapon); GameBean.mapInfo.getPathMap().put(location, tileInfo); chkBox.setSelected(true); this.revalidate(); return; } catch (Exception e) { System.out.println("WeaponEditorPanel : actionPerformed() : Some error occured " + e); } } else { validationMess.setText("Pls enter all the fields or pls choose a weapon from the drop down"); validationMess.setVisible(true); panel.revalidate(); } } }
From source file:Controller.Movimientos.ControllerMovimientos.java
@Override public void actionPerformed(ActionEvent e) { switch (Actions.valueOf(e.getActionCommand())) { case btn_home: this.v.pnl_Main.removeAll(); this.v.pnl_Main.add(this.v.SplitPane1, BorderLayout.CENTER); this.v.pnl_Main.setVisible(false); this.v.pnl_Main.setVisible(true); break;/* w w w . jav a 2 s . c o m*/ case btn_ventasMovi: this.v.pnl_contenedorDerechoMovimientos.removeAll(); this.v.pnl_contenedorDerechoMovimientos.add(this.v.pnl_contenedorDerecho, BorderLayout.CENTER); this.v.pnl_contenedorDerechoMovimientos.setVisible(false); this.v.pnl_contenedorDerechoMovimientos.setVisible(true); DefaultCategoryDataset b = new DefaultCategoryDataset(); b.setValue(mm.getRecordEnero(), "Ventas", "Ene"); b.setValue(mm.getRecordFebrero(), "Ventas", "Feb"); b.setValue(mm.getRecordMarzo(), "Ventas", "Mar"); b.setValue(mm.getRecordAbril(), "Ventas", "Abr"); b.setValue(mm.getRecordMayo(), "Ventas", "May"); b.setValue(mm.getRecordJunio(), "Ventas", "Jun"); b.setValue(mm.getRecordJulio(), "Ventas", "Jul"); b.setValue(mm.getRecordAgosto(), "Ventas", "Ago"); b.setValue(mm.getRecordSeptiembre(), "Ventas", "Sep"); b.setValue(mm.getRecordOctubre(), "Ventas", "Oct"); b.setValue(mm.getRecordNoviembre(), "Ventas", "Nov"); b.setValue(mm.getRecordNoviembre(), "Ventas", "Dic"); JFreeChart grafica = ChartFactory.createBarChart("Ventas", "Meses", "Numero de ventas", b, PlotOrientation.VERTICAL, false, true, false); CategoryPlot graficaPlot = grafica.getCategoryPlot(); graficaPlot.setRangeGridlinePaint(Color.BLUE); ChartPanel barPanel = new ChartPanel(grafica); this.v.pnl_mostrarGrafica.removeAll(); this.v.pnl_mostrarGrafica.add(barPanel, BorderLayout.CENTER); this.v.pnl_mostrarGrafica.setVisible(false); this.v.pnl_mostrarGrafica.setVisible(true); mostrarFilechooser(); break; case btn_empleMovi: this.v.pnl_contenedorDerechoMovimientos.removeAll(); this.v.pnl_contenedorDerechoMovimientos.add(this.v.pnl_contenedorDerecho, BorderLayout.CENTER); this.v.pnl_contenedorDerechoMovimientos.setVisible(false); this.v.pnl_contenedorDerechoMovimientos.setVisible(true); DefaultCategoryDataset bE = new DefaultCategoryDataset(); Iterator it; it = mm.getCrews().iterator(); while (it.hasNext()) { Crew c = (Crew) it.next(); System.out.println("" + c.getEmail().toString()); bE.setValue(mm.getConexionesCount(c.getEmail().toString()), c.getEmail().toString(), c.getEmail().toString()); } JFreeChart graficaEmpleado = ChartFactory.createBarChart("Conexiones", "Meses", "Numero de ventas", bE, PlotOrientation.VERTICAL, false, true, false); CategoryPlot graficaPlotEmpleado = graficaEmpleado.getCategoryPlot(); graficaPlotEmpleado.setRangeGridlinePaint(Color.BLUE); ChartPanel barPanelEmpleado = new ChartPanel(graficaEmpleado); this.v.pnl_mostrarGrafica.removeAll(); this.v.pnl_mostrarGrafica.add(barPanelEmpleado, BorderLayout.CENTER); this.v.pnl_mostrarGrafica.setVisible(false); this.v.pnl_mostrarGrafica.setVisible(true); mostrarFilechooser(); break; case btn_productoMovi: this.v.pnl_contenedorDerechoMovimientos.removeAll(); this.v.pnl_contenedorDerechoMovimientos.add(this.v.pnl_contenedorDerecho, BorderLayout.CENTER); this.v.pnl_contenedorDerechoMovimientos.setVisible(false); this.v.pnl_contenedorDerechoMovimientos.setVisible(true); DefaultCategoryDataset bP = new DefaultCategoryDataset(); Iterator itP; itP = mm.getProducts().iterator(); while (itP.hasNext()) { Product p = (Product) itP.next(); System.out.println("" + p.getName()); bP.setValue(mm.getProductCount(p.getName().toString()), p.getName().toString(), p.getName().toString()); } JFreeChart graficaProducto = ChartFactory.createBarChart("Productos Vendidos", "Productos", "Ventas", bP, PlotOrientation.HORIZONTAL, false, true, false); CategoryPlot graficaPlotProducto = graficaProducto.getCategoryPlot(); graficaPlotProducto.setRangeGridlinePaint(Color.BLUE); ChartPanel barPanelProducto = new ChartPanel(graficaProducto); this.v.pnl_mostrarGrafica.removeAll(); this.v.pnl_mostrarGrafica.add(barPanelProducto, BorderLayout.CENTER); this.v.pnl_mostrarGrafica.setVisible(false); this.v.pnl_mostrarGrafica.setVisible(true); mostrarFilechooser(); break; case btn_configMovimientos: break; case btn_abrirFilechooser: break; case btn_informe: this.pdf.generateInforme(); break; } }
From source file:com.asascience.edc.ui.ASACatalogFactoryCancellable.java
/** * Pops up a ProgressMonitor to allow user cancellation while reading the * named catalog. This method immediately returns, and the reading is done * on a background thread. If successfully read, callback.setCatalog() is * called on the awt event thread. If failure, the user will be given a * popup error message, and callback.failure() is called.. * * @param catalogName//w ww . j a v a 2s .c o m * : the URI name that the XML doc is at. * @param callbacker * : this will be called (from AWT thread) if catalog was * successfully called. */ public void readXMLasynch(String catalogName, CatalogSetCallback callbacker) { this.callback = callbacker; callbackDone = false; taskDone = false; openTask = new OpenCatalogTask(catalogName); ProgressMonitor pm = new ProgressMonitor(openTask, 10, 10); pm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (debug) { System.err.println("ProgressMonitor event " + e.getActionCommand()); } if (e.getActionCommand().equals("success")) { checkFailure(); } else { callback.failed(); } callbackDone = true; } }); pm.start(parent, "Open catalog " + catalogName, 20); }
From source file:SoundBug.java
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); Object source = e.getSource(); if (action == soundNoneString) { soundSwitch.setWhichChild(SOUND_NONE); } else if (action == soundBackgroundActionString) { soundSwitch.setWhichChild(SOUND_BACKGROUND); } else if (action == soundPointActionString) { soundSwitch.setWhichChild(SOUND_POINT); }// www.j a v a2 s .co m }