List of usage examples for java.awt.event ActionEvent getSource
public Object getSource()
From source file:BRHInit.java
public void actionPerformed(ActionEvent ae) { if (ae.getSource() == login_ok) { login_window.setVisible(false);// w w w . j a va 2 s .c o m login(email.getText(), password.getText()); } else if (ae.getSource() == vps_list_ok) { int idx = vps_list_box.getSelectedIndex(); if (idx >= 0) { vps_list_window.setVisible(false); selectVPS(idx); } } else if (ae.getSource() == login_cancel || ae.getSource() == vps_list_cancel) { System.exit(0); } }
From source file:gui.FormFrame.java
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == finish) { if (usage == "add") { System.out.println("Ajout d'un pays"); ListableBeanFactory bf;//from w ww . j av a2 s . c o m bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); IPaysMetier instance = (IPaysMetier) bf.getBean("paysMetier"); Map<String, String> arg = new HashMap(); arg.put("ID", IDJTF.getText()); arg.put("indicatif", indicatifJTF.getText()); arg.put("nationalite", nationaliteJTF.getText()); arg.put("libelle_fr", libellefrJTF.getText()); arg.put("libelle_en", libelleenJTF.getText()); arg.put("monnaie_code", monnaie_codeJTF.getText()); arg.put("monnaie_perdiem", monnaie_pdJTF.getText()); arg.put("taux_change", tauxJTF.getText()); arg.put("danger", dangerJTF.getText()); arg.put("drapeau", drapeauJTF.getText()); arg.put("coords1", coords1JTF.getText()); arg.put("coords2", coords2JTF.getText()); arg.put("coords3", coords3JTF.getText()); arg.put("coords4", coords4JTF.getText()); arg.put("coords5", coords5JTF.getText()); instance.createPays(arg); super.dispose(); } if (usage == "del") { System.out.println("Delete d'un pays"); System.out.println(JCB.getSelectedItem().toString()); ListableBeanFactory bf; bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); IPaysMetier instance = (IPaysMetier) bf.getBean("paysMetier"); instance.deletePays(JCB.getSelectedItem().toString()); super.dispose(); } if (usage == "update" && argpays == null) { try { System.out.println("Update d'un pays"); System.out.println(JCB.getSelectedItem()); ListableBeanFactory bf; bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); IPaysMetier instance = (IPaysMetier) bf.getBean("paysMetier"); Pays result = instance.findPays((String) JCB.getSelectedItem()); FormFrame formFrame = new FormFrame(mainHandler, "update", result); super.dispose(); } catch (PaysNotFoundException ex) { Logger.getLogger(FormFrame.class.getName()).log(Level.SEVERE, null, ex); } } if (usage == "update" && argpays != null) { ListableBeanFactory bf; bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); IPaysMetier instance = (IPaysMetier) bf.getBean("paysMetier"); Map<String, String> arg = new HashMap(); arg.put("ID", IDJTF.getText()); arg.put("indicatif", indicatifJTF.getText()); arg.put("nationalite", nationaliteJTF.getText()); arg.put("libelle_fr", libellefrJTF.getText()); arg.put("libelle_en", libelleenJTF.getText()); arg.put("monnaie_code", monnaie_codeJTF.getText()); arg.put("monnaie_perdiem", monnaie_pdJTF.getText()); arg.put("taux_change", tauxJTF.getText()); arg.put("danger", dangerJTF.getText()); arg.put("drapeau", drapeauJTF.getText()); arg.put("coords1", coords1JTF.getText()); arg.put("coords2", coords2JTF.getText()); arg.put("coords3", coords3JTF.getText()); arg.put("coords4", coords4JTF.getText()); arg.put("coords5", coords5JTF.getText()); instance.updatePays(argpays.getLibelleFr(), arg); super.dispose(); } } }
From source file:client.gui.ConnectionDialog.java
public void actionPerformed(final ActionEvent event) { String nick = null;/*from w w w . ja v a2s . c o m*/ String host = null; int port = 0; if (event.getSource() == connect) { nick = this.nick.getText(); host = this.host.getText(); try { port = Integer.parseInt(this.port.getText()); } catch (NumberFormatException e1) { new MyDialog("Port number must be integer").setVisible(true); return; } } else if (event.getSource() == connectDev) { nick = generateNick(); host = "localhost"; port = 5555; } else if (event.getSource() == connectSame) { nick = "a"; host = "localhost"; port = 5555; } if (port <= 0) { new MyDialog("Port number must be bigger than 0").setVisible(true); return; } Socket socket; BufferedReader in; try { socket = new Socket(host, port); GlobalVariables.out = new PrintWriter(socket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); } catch (java.net.UnknownHostException e2) { new MyDialog("Unknown host").setVisible(true); return; } catch (IOException e3) { new MyDialog("Connection unsuccessful").setVisible(true); GlobalVariables.connected = false; return; } catch (java.lang.IllegalArgumentException e4) { new MyDialog("Port number is too big").setVisible(true); return; } System.out.println("Nick: " + nick); final JSONArray toSend = new JSONArray(); try { toSend.put(new JSONObject().put("action", "first_connection")); toSend.put(new JSONObject().put("nick", nick)); } catch (JSONException e1) { e1.printStackTrace(); } GlobalVariables.daemon = true; GlobalVariables.me.setNick(nick); GlobalVariables.connect.setEnabled(false); GlobalVariables.connected = true; setVisible(false); GlobalVariables.out.println(toSend); Thread thread; thread = new ReceivingData(in); thread.setDaemon(true); thread.start(); }
From source file:org.yccheok.jstock.gui.SellPortfolioTimeChartJDialog.java
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed String selected = ((javax.swing.JComboBox) evt.getSource()).getSelectedItem().toString(); final int selectedIndex = ((javax.swing.JComboBox) evt.getSource()).getSelectedIndex(); MainFrame.getInstance().getJStockOptions().setLastSelectedSellPortfolioChartIndex(selectedIndex); final JFreeChart freeChart = this.createChart(selected); org.yccheok.jstock.charting.Utils.applyChartTheme(freeChart); chartPanel.setChart(freeChart);//from ww w . ja va 2 s.co m }
From source file:org.adempiere.apps.graph.PerformanceIndicator.java
/** * Action Listener.// ww w . j a v a 2 s . c o m * Update Display * @param e event */ public void actionPerformed(ActionEvent e) { if (e.getSource() == mRefresh) { m_goal.updateGoal(true); updateDisplay(); // Container parent = getParent(); if (parent != null) parent.invalidate(); invalidate(); if (parent != null) parent.repaint(); else repaint(); } }
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); }/*from w ww .ja v a 2s . co m*/ }
From source file:DragFileDemo.java
public void actionPerformed(ActionEvent e) { if (e.getSource() == clear) { tpc.clearAll(); } }
From source file:FileLister.java
/** * This ActionListener method is invoked when the user double-clicks on an * entry or clicks on one of the buttons. If they double-click on a file, * create a FileViewer to display that file. If they double-click on a * directory, call the listDirectory() method to display that directory *//*from w ww . j a v a 2 s .c o m*/ public void actionPerformed(ActionEvent e) { if (e.getSource() == close) this.dispose(); else if (e.getSource() == up) { up(); } else if (e.getSource() == list) { // Double click on an item int i = list.getSelectedIndex(); // Check which item if (i == 0) up(); // Handle first Up To Parent item else { // Otherwise, get filename String name = files[i - 1]; File f = new File(currentDir, name); // Convert to a File String fullname = f.getAbsolutePath(); if (f.isDirectory()) listDirectory(fullname); // List dir else new FileViewer(fullname).show(); // display file } } }
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); }//from w ww .j a v a 2 s .c o m }
From source file:endrov.frameTime.FrameTimeWindow.java
public void actionPerformed(ActionEvent e) { if (e.getSource() == objectCombo) { loadData();/*from w ww .j ava2s . c o m*/ } if (e.getSource() == bAdd) { addEntry(EvDecimal.ZERO, EvDecimal.ZERO); fillGraphpart(); fillDatapart(); } else if (e.getSource() == bRefresh) { loadData(); } else if (e.getSource() == bApply) { applyData(); } for (int i = 0; i < inputVector.size(); i++) if (inputVector.get(i).bDelete == e.getSource()) { //TODO non-optimal. keep track of entry in map. then push through change right away inputVector.remove(i); fillGraphpart(); fillDatapart(); } }