List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.links_redundantes.PanelLinkRedundante.java
public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd == "Salvar") { salvaAlteracoes.salvar();// ww w .j a v a 2 s .c o m /* if (arquivo == null) { salvarComo(); // avalia(); return; } arquivo.write(boxCode.getText());//*/ //avalia(); reavalia(textAreaSourceCode.getText()); } else if (cmd == "Aplicar") { if (controle != null) { int pos = controle.getIniIndex(erroAtual); String newCod; try { newCod = controle.corrige(texto.getText(), erroAtual); textAreaSourceCode.setText(newCod); salvaAlteracoes.setAlterado(); TxtBuffer.setContent(textAreaSourceCode.getText()); reavalia(newCod); textAreaSourceCode.getTextPane().setCaretPosition(pos); } catch (ExceptionImagemNotFound e1) { JOptionPane.showMessageDialog(this, e1.getMessage()); } controle.avalia(textAreaSourceCode.getText(), true); } } else if (cmd == "AbrirURL") { String url; url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://"); avaliaUrl(url); // JOptionPane.showMessageDialog(null, "Seu nome " + nome); } else if (cmd == "Abrir") { String a[] = { ".html", ".htm" }; G_File temp = new G_File(caminhoRecente.read(), a); if (temp.getFile() != null) { avaliaArq(temp); } } else if (cmd == "SaveAs") { //salvarComo(); salvaAlteracoes.salvarComo(); // avalia(); } else if (cmd == "Creditos") { new Creditos(); } else if (cmd == "Sair") { System.exit(0); } else if (cmd == "Desfazer") { textAreaSourceCode.undo(); //boxCode.coloreSource(); //reavalia(boxCode.getText()); } else if (cmd == "AumentaFonte") { textAreaSourceCode.aumentaFontSize(); } else if (cmd == "DiminuiFonte") { textAreaSourceCode.diminuiFontSize(); } else if (cmd == "Contraste") { textAreaSourceCode.autoContraste(); reavalia(textAreaSourceCode.getText()); } else if (cmd == "SelecionarTudo") { textAreaSourceCode.getTextPane().selectAll(); if (painelOriginal != null) { painelOriginal.textAreaSourceCode.getTextPane().selectAll(); } } else if (cmd == "Cancelar") { salvaAlteracoes.cancelar(); } }
From source file:jeplus.gui.EPlusEditorPanel.java
@Override public void actionPerformed(ActionEvent e) { // "FindNext" => search forward, "FindPrev" => search backward String command = e.getActionCommand(); if (command != null && command.toLowerCase().equals("tab closing")) { closeTextPanel();/*from ww w.ja v a 2 s .co m*/ } else { boolean forward = "FindNext".equals(command); // Create an object defining our search parameters. SearchContext context = new SearchContext(); String text = searchField.getText(); if (text.length() == 0) { return; } context.setSearchFor(text); context.setMatchCase(matchCaseCB.isSelected()); context.setRegularExpression(regexCB.isSelected()); context.setSearchForward(forward); context.setWholeWord(false); SearchResult found = SearchEngine.find(rsTextArea, context); if (!found.wasFound()) { rsTextArea.setCaretPosition(forward ? 0 : rsTextArea.getDocument().getLength() - 1); found = SearchEngine.find(rsTextArea, context); if (!found.wasFound()) { JOptionPane.showMessageDialog(this, "Text not found"); } } } }
From source file:de.tor.tribes.ui.views.DSWorkbenchConquersFrame.java
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Find")) { BufferedImage back = ImageUtils.createCompatibleBufferedImage(3, 3, BufferedImage.TRANSLUCENT); Graphics g = back.getGraphics(); g.setColor(new Color(120, 120, 120, 120)); g.fillRect(0, 0, back.getWidth(), back.getHeight()); g.setColor(new Color(120, 120, 120)); g.drawLine(0, 0, 3, 3);//w ww.j a v a2s . c o m g.dispose(); TexturePaint paint = new TexturePaint(back, new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight())); jxFilterPane.setBackgroundPainter(new MattePainter(paint)); DefaultListModel model = new DefaultListModel(); for (int i = 0; i < jConquersTable.getColumnCount(); i++) { TableColumnExt col = jConquersTable.getColumnExt(i); if (col.isVisible() && !col.getTitle().equals("Entfernung") && !col.getTitle().equals("Dorfpunkte")) { model.addElement(col.getTitle()); } } jXColumnList.setModel(model); jXColumnList.setSelectedIndex(0); jxFilterPane.setVisible(true); } }
From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java
/** * Default constructor is required by Funambol Admin UI *///from www . j a va2 s . c o m public Db4oSyncSourceConfigPanel() { setupControls(); // now we install our event handlers and we are ready to go... // handler to update the SyncClassConfigTree upon a change // in database file _dbFileLocateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { final JFileChooser fc = new JFileChooser(); int rc = fc.showOpenDialog(Db4oSyncSourceConfigPanel.this); if (JFileChooser.APPROVE_OPTION == rc) { File f = fc.getSelectedFile(); _dbFileValue.setText(f.getPath()); Db4oSyncSourceConfigPanel.this.refreshClassConfigsFromFile(); } } catch (Exception ex) { StringWriter s = new StringWriter(); PrintWriter w = new PrintWriter(s); ex.printStackTrace(w); notifyError(new AdminException(s.toString())); } } }); // handler for the "Add" or "Update" button _confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); updateSyncSource(); if (getState() == STATE_INSERT) { Db4oSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( Db4oSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { Db4oSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( Db4oSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); }
From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java
/** * On any menu item click./* w w w .j a va 2 s . com*/ */ @Override public void actionPerformed(ActionEvent arg0) { State.print(arg0.getActionCommand()); switch (arg0.getActionCommand()) { case "new": //Try to save work, open new show try { newShow(); } catch (InterruptedException e) { e.printStackTrace(); } break; case "open": //Try to save work, get new show openShow(); break; case "save": Main.save(); break; case "saveas": try { saveAs(); } catch (InterruptedException e) { e.printStackTrace(); } break; case "printpage": try { desktop.setCursor(new Cursor(Cursor.WAIT_CURSOR)); desktop.printCurrentPageToPdf(); desktop.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (IOException e) { e.printStackTrace(); } break; case "printshow": try { desktop.setCursor(new Cursor(Cursor.WAIT_CURSOR)); desktop.printAllPagesToPdf(); desktop.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (IOException e) { e.printStackTrace(); } break; case "printdotsheets": try { desktop.setCursor(new Cursor(Cursor.WAIT_CURSOR)); new DotSheetMaker().printDotSheets(); desktop.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } catch (InterruptedException e) { e.printStackTrace(); } break; case "togglegrid": Main.getState().getSettings().setShowGrid(!Main.getState().getSettings().shouldShowGrid()); ((JMenu) getComponent(2)).getMenuComponent(0) .setForeground(Main.getState().getSettings().shouldShowGrid() ? Color.BLACK : Color.RED); break; case "togglenames": Main.getState().getSettings().setShowNames(!Main.getState().getSettings().shouldShowNames()); ((JMenu) getComponent(2)).getMenuComponent(1) .setForeground(Main.getState().getSettings().shouldShowNames() ? Color.BLACK : Color.RED); break; case "toggletext": Main.getState().getSettings().setShowText(!Main.getState().getSettings().shouldShowText()); ((JMenu) getComponent(2)).getMenuComponent(2) .setForeground(Main.getState().getSettings().shouldShowText() ? Color.BLACK : Color.RED); break; case "colordots": Main.getState().getSettings().setColorDots(!Main.getState().getSettings().shouldColorDots()); ((JMenu) getComponent(2)).getMenuComponent(3) .setForeground(Main.getState().getSettings().shouldColorDots() ? Color.BLACK : Color.RED); break; case "changehash": Main.getState().getSettings().setCollegeHashes(!Main.getState().getSettings().useCollegeHashes()); ((JMenuItem) (((JMenu) getComponent(2)).getMenuComponent(4))) .setText(Main.getState().getSettings().useCollegeHashes() ? "Change to High School Hashes" : "Change to College Hashes"); try { desktop.getImage(); } catch (IOException e) { e.printStackTrace(); } desktop.getDotDataFrame().updatePosition(); break; case "fontsize": changeFontSize(); break; case "play": play(); break; case "undo": Main.getState().undo(); desktop.getIO().clearActivePoints(); desktop.getDotDataFrame().updateAll(desktop.getActivePoints()); break; case "redo": Main.getState().redo(); desktop.getIO().clearActivePoints(); desktop.getDotDataFrame().updateAll(desktop.getActivePoints()); break; case "help": help(); break; case "about": about(); break; case "quit": default: gr.dispatchEvent(new WindowEvent(gr, WindowEvent.WINDOW_CLOSING)); } desktop.getIO().fixControl(); }
From source file:imageuploader.ImgWindow.java
private void jCB_ColorsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCB_ColorsActionPerformed // TODO add your handling code here: eventCounter++;/*from w w w . jav a 2s . c o m*/ if (evt.getActionCommand().equals("comboBoxChanged")) { if (jCB_Colors.getModel().getSize() > 0) { String a = jCB_Colors.getSelectedItem().toString(); DefaultListModel listM = (DefaultListModel) jL_Info.getModel(); if (eventCounter > 2) { if (listM.contains(a) == false) { listM.addElement(a); // boolean add = list.add(jCB_Colors.getSelectedItem().toString()); } } } } }
From source file:com.funambol.email.admin.EmailSyncSourceConfigPanel.java
/** * Create the panel/*w w w.j a v a 2 s . c o m*/ */ public void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder1 = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText("Edit Email Connector SyncSource"); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder1); // -------- sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(14, 70, 150, 19)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(170, 70, 350, 19)); nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(14, 100, 150, 19)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(170, 100, 350, 19)); infoTypesLabel.setText("Supported Types: "); infoTypesLabel.setFont(defaultFont); infoTypesLabel.setBounds(new Rectangle(14, 130, 150, 19)); infoTypesValue.setFont(defaultFont); infoTypesValue.setBounds(new Rectangle(170, 130, 350, 19)); infoTypesValue.setEnabled(false); infoVersionsLabel.setText("Supported Versions: "); infoVersionsLabel.setFont(defaultFont); infoVersionsLabel.setBounds(new Rectangle(14, 160, 150, 19)); infoVersionsValue.setFont(defaultFont); infoVersionsValue.setBounds(new Rectangle(170, 160, 350, 19)); infoVersionsValue.setEnabled(false); dtEncryptLabel.setText("Encryption: "); dtEncryptLabel.setFont(defaultFont); dtEncryptLabel.setBounds(new Rectangle(14, 190, 150, 18)); dtEncryptValue.setSelected(false); dtEncryptValue.setBounds(new Rectangle(166, 190, 25, 19)); contentProviderURLLabel.setText("Content Provider URL: "); contentProviderURLLabel.setFont(defaultFont); contentProviderURLLabel.setBounds(new Rectangle(14, 250, 150, 19)); contentProviderURLValue.setFont(defaultFont); contentProviderURLValue.setBounds(new Rectangle(170, 250, 350, 19)); signatureLabel.setText("Funambol Signature: "); signatureLabel.setFont(defaultFont); signatureLabel.setBounds(new Rectangle(14, 220, 150, 19)); signatureValue.setFont(defaultFont); signatureValue.setBounds(new Rectangle(170, 220, 350, 19)); confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(170, 280, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { EmailSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( EmailSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { EmailSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( EmailSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); // add all components to the panel this.add(panelName, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameLabel, null); this.add(nameValue, null); this.add(infoTypesLabel, null); this.add(infoTypesValue, null); this.add(infoVersionsLabel, null); this.add(infoVersionsValue, null); this.add(dtEncryptLabel, null); this.add(dtEncryptValue, null); // Uncomment the next two lines if you want to show the Content Provider URL // input field //this.add(contentProviderURLLabel, null); //this.add(contentProviderURLValue, null); this.add(signatureLabel, null); this.add(signatureValue, null); this.add(confirmButton, null); }
From source file:com.funambol.foundation.admin.FileSystemSyncSourceConfigPanel.java
/** * Create the panel/* w ww .j a v a2 s .com*/ * @throws Exception if error occures during creation of the panel */ private void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder1 = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText("Edit File System SyncSource"); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder1); int y = 60; int dy = 30; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(14, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(14, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; directoryLabel.setText("Source Directory: "); directoryLabel.setFont(defaultFont); directoryLabel.setBounds(new Rectangle(14, y, 150, 18)); directoryValue.setFont(defaultFont); directoryValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; infoTypesLabel.setText("Supported types: "); infoTypesLabel.setFont(defaultFont); infoTypesLabel.setBounds(new Rectangle(14, y, 150, 18)); infoTypesValue.setFont(defaultFont); infoTypesValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; infoVersionsLabel.setText("Supported versions: "); infoVersionsLabel.setFont(defaultFont); infoVersionsLabel.setBounds(new Rectangle(14, y, 150, 18)); infoVersionsValue.setFont(defaultFont); infoVersionsValue.setBounds(new Rectangle(170, y, 350, 18)); y += dy; multiUserLabel.setText("MultiUser: "); multiUserLabel.setFont(defaultFont); multiUserLabel.setBounds(new Rectangle(14, y, 150, 18)); multiUserValue.setSelected(false); multiUserValue.setBounds(167, y, 50, 25); y += dy; y += dy; confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(170, y, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { FileSystemSyncSourceConfigPanel.this .actionPerformed(new ActionEvent(FileSystemSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { FileSystemSyncSourceConfigPanel.this .actionPerformed(new ActionEvent(FileSystemSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); // add all components to the panel this.add(panelName, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameLabel, null); this.add(nameValue, null); this.add(directoryLabel, null); this.add(directoryValue, null); this.add(infoTypesLabel, null); this.add(infoTypesValue, null); this.add(infoVersionsLabel, null); this.add(infoVersionsValue, null); this.add(multiUserLabel, null); this.add(multiUserValue, null); this.add(confirmButton, null); }
From source file:com.borqs.sync.server.contact.admin.ContactSyncSourceAdminPanel.java
/** * Create the panel/*www. jav a2 s. c om*/ * @throws Exception if error occures during creation of the panel */ private void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText(getPanelName()); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder); final int LABEL_X = 14; final int VALUE_X = 170; int y = 60; final int GAP_X = 150; final int GAP_Y = 30; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line typeLabel.setText("Client Type: "); typeLabel.setFont(defaultFont); typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); typeCombo.setFont(defaultFont); typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line datastoretypeLabel.setText("Datastore Type: "); datastoretypeLabel.setFont(defaultFont); datastoretypeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); datastoretypeCombo.setFont(defaultFont); datastoretypeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line int x = LABEL_X; confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(VALUE_X, y, 70, 25); // What happens when the confirmButton is pressed? confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { ContactSyncSourceAdminPanel.this.actionPerformed(new ActionEvent( ContactSyncSourceAdminPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { ContactSyncSourceAdminPanel.this.actionPerformed(new ActionEvent( ContactSyncSourceAdminPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage(), e)); } } }); // Adds all components to the panel this.add(panelName, null); this.add(nameLabel, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameValue, null); this.add(typeLabel, null); this.add(typeCombo, null); this.add(confirmButton, null); this.add(datastoretypeLabel, null); this.add(datastoretypeCombo, null); }
From source file:com.prezerak.windmill.gui.AveragesPanel.java
/** * Creates a sample chart.//www . j a v a 2 s . c om * * @return a sample chart. */ @Override public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals("Print Graph")) { PrintUtilities.printComponent(chartPanel); } else if (evt.getActionCommand().equals("Back to Real")) { backToRealTime(); } else if (evt.getActionCommand().equals("Report")) { ButtonModel btnModel = WindMill.mainFrame.getAvgButtonGroup().getSelection(); long pollInterval = Long.parseLong(btnModel.getActionCommand()) / 60; String titlePad; if (pollInterval == 0) titlePad = " (actual)"; else titlePad = " (" + Long.toString(pollInterval) + " mins)"; new ReportDialog(WindMill.mainFrame, "Wind Report" + titlePad, datasetVel, datasetDir, " " + WindMill.mainFrame.getButtonGroupUnits().getSelection().getActionCommand(), pollInterval, rsVelDir); } else if (evt.getActionCommand().equals("Alarm Report")) { new AlarmReportDialog(WindMill.mainFrame, "Alarm Report", true, WindMill.database.queryAllAlarms(startDate, endDate), datasetGust, datasetHigh, datasetHigher); } }