List of usage examples for javax.swing JButton getText
public String getText()
From source file:com.kenai.redminenb.util.RedmineUtil.java
public static boolean show(ActionListenerPanel panel, String title, String okName) { JButton ok = new JButton(okName); JButton cancel = new JButton("Cancel"); // NOI18N final DialogDescriptor dd = new DialogDescriptor(panel, title, true, new Object[] { ok, cancel }, ok, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, panel); ok.getAccessibleContext().setAccessibleDescription(ok.getText()); cancel.getAccessibleContext().setAccessibleDescription(cancel.getText()); panel.setOkButton(ok);/*from ww w.j av a 2 s.c om*/ panel.setCancelButton(cancel); panel.setDialogDescribtor(dd); dd.setClosingOptions(new Object[] { cancel }); return DialogDisplayer.getDefault().notify(dd) == ok; }
From source file:MyActionListener.java
public void actionPerformed(ActionEvent e) { JButton source = (JButton) e.getSource(); String buttonText = source.getText(); JOptionPane.showMessageDialog(null, "You clicked" + buttonText); }
From source file:ButtonListener.java
public void actionPerformed(ActionEvent e) { JButton o = (JButton) e.getSource(); String label = o.getText(); System.out.println(label + " button clicked"); }
From source file:MyActionListener.java
public void actionPerformed(ActionEvent e) { System.out.println("Command: " + e.getActionCommand()); Object source = e.getSource(); if (source instanceof JButton) { JButton jb = (JButton) source; System.out.println("JButton: " + jb.getText()); }// w ww . j a va 2 s . c o m }
From source file:MyActionListener.java
public void actionPerformed(ActionEvent e) { System.out.println("Command: " + e.getActionCommand()); int modifiers = e.getModifiers(); System.out.println("\tALT : " + checkMod(modifiers, ActionEvent.ALT_MASK)); System.out.println("\tCTRL : " + checkMod(modifiers, ActionEvent.CTRL_MASK)); System.out.println("\tMETA : " + checkMod(modifiers, ActionEvent.META_MASK)); System.out.println("\tSHIFT: " + checkMod(modifiers, ActionEvent.SHIFT_MASK)); Object source = e.getSource(); if (source instanceof JButton) { JButton jb = (JButton) source; System.out.println("JButton: " + jb.getText()); }//from w ww . j a v a2s .com }
From source file:com.github.kennycyb.uifactory.core.factory.impl.components.swing.JButtonFactory.java
@Override public void initialize(final ComponentContext context) { super.initialize(context); final JButton component = (JButton) context.getComponent(); if (component.getText() == null || component.getText().length() == 0) { component.setText(StringUtils.capitalize(context.getId())); }//from www. ja v a2s . c om }
From source file:lockers.FrameCobro.java
private void getRates() { JSONArray array = Utils.getJSONArrayFromURL("http://127.0.0.1:8000/Rates/?format=json"); if (array.size() == 0) { this.jLblAvailableLockers.setText("No hay disponibilidad"); } else {//from w ww . ja v a 2 s.c om for (Object array1 : array) { JButton nuevo = new JButton(); JSONObject obj2 = (JSONObject) array1; System.out.println(obj2.size()); nuevo.setText(obj2.get("rate_name") + ": " + obj2.get("rate_rate")); nuevo.setVisible(true); nuevo.setSize(200, 50); nuevo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source instanceof JButton) { JButton btn = (JButton) source; System.out.println("You clicked the button " + btn.getText()); } } }); this.jPanel1.add(nuevo); } } }
From source file:inet.CalculationNetworkEditor.visual.control.listener.BothGraphActions.java
@Override public void actionPerformed(ActionEvent e) { Object objSource = e.getSource(); if (objSource instanceof JButton) { JButton jbtnSource = (JButton) objSource; if ("relocate".equals(jbtnSource.getText())) { System.out.println("jbtn Relocate"); relocateVertexes();//w w w .j av a2 s . c o m } else if ("visualize".equals(jbtnSource.getText())) { System.out.println("jbtn Visualize"); visualizeStacking(); } } }
From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java
public void actionPerformed(ActionEvent e) { JButton jb = ((JButton) e.getSource()); if (jb.getText().equals("o^")) { try {/*w w w . j ava2 s . co m*/ StreamSpinnerConnection = new DefaultCQRowSet(); StreamSpinnerConnection.setUrl("//" + url + "/StreamSpinnerServer"); StreamSpinnerConnection.setCommand(getJTextArea().getText()); StreamSpinnerConnection.addCQRowSetListener(this); StreamSpinnerConnection.start(); jb.setEnabled(false); getJButton1().setEnabled(false); } catch (CQException ce) { ce.printStackTrace(); } } else if (jb.getText().equals("Q?")) { show_open_hamql_dialog(); } }
From source file:com.hp.alm.ali.idea.cfg.AliConfigurable.java
protected Component getSouthernComponent() { JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); final TroubleShootService troubleShootService = ApplicationManager.getApplication() .getComponent(TroubleShootService.class); final JButton troubleshoot = new JButton( troubleShootService.isRunning() ? "Stop Troubleshoot" : "Troubleshoot"); troubleshoot.addActionListener(new ActionListener() { @Override//w w w . ja v a 2 s .c o m public void actionPerformed(ActionEvent e) { if (troubleshoot.getText().equals("Troubleshoot")) { if (!troubleShootService.isRunning()) { if (Messages.showYesNoDialog("Do you want to log complete ALM server communication?", "Confirmation", null) == Messages.YES) { FileSaverDescriptor desc = new FileSaverDescriptor("Log server communication", "Log server communication on the local filesystem."); final VirtualFileWrapper file = FileChooserFactory.getInstance() .createSaveFileDialog(desc, troubleshoot).save(null, "REST_log.txt"); if (file == null) { return; } troubleShootService.start(file.getFile()); troubleshoot.setText("Stop Troubleshoot"); } } } else { troubleShootService.stop(); troubleshoot.setText("Troubleshoot"); } } }); southPanel.add(troubleshoot); return southPanel; }