List of usage examples for java.awt.event ActionEvent getActionCommand
public String getActionCommand()
From source file:TexBug.java
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); Object source = e.getSource(); if (action == texEnableString) { texEnable = texEnableCheckBox.isSelected(); System.out.println("texture.setEnable(" + texEnable + ")"); texture.setEnable(texEnable);// w w w . j av a 2 s . c o m } else if (action == texBoundarySWrapString) { texBoundaryModeS = Texture.WRAP; setTexture(); } else if (action == texBoundarySClampString) { texBoundaryModeS = Texture.CLAMP; setTexture(); } else if (action == texBoundaryTWrapString) { texBoundaryModeT = Texture.WRAP; setTexture(); } else if (action == texBoundaryTClampString) { texBoundaryModeT = Texture.CLAMP; setTexture(); } else if (action == texMinFilterBasePointString) { texMinFilter = Texture.BASE_LEVEL_POINT; setTexture(); } else if (action == texMinFilterBaseLinearString) { texMinFilter = Texture.BASE_LEVEL_LINEAR; setTexture(); } else if (action == texMinFilterMultiPointString) { texMinFilter = Texture.MULTI_LEVEL_POINT; setTexture(); } else if (action == texMinFilterMultiLinearString) { texMinFilter = Texture.MULTI_LEVEL_LINEAR; setTexture(); } else if (action == texMinFilterFastestString) { texMinFilter = Texture.FASTEST; setTexture(); } else if (action == texMinFilterNicestString) { texMinFilter = Texture.NICEST; setTexture(); } else if (action == texMagFilterBasePointString) { texMagFilter = Texture.BASE_LEVEL_POINT; setTexture(); } else if (action == texMagFilterBaseLinearString) { texMagFilter = Texture.BASE_LEVEL_LINEAR; setTexture(); } else if (action == texMagFilterNicestString) { texMagFilter = Texture.NICEST; setTexture(); } else if (action == texMagFilterFastestString) { texMagFilter = Texture.FASTEST; setTexture(); } else if (action == texMipMapBaseString) { texMipMapMode = Texture.BASE_LEVEL; setTexture(); } else if (action == texMipMapMultiString) { texMipMapMode = Texture.MULTI_LEVEL_MIPMAP; setTexture(); } }
From source file:erigo.filepump.FilePump.java
public void actionPerformed(ActionEvent eventI) { Object source = eventI.getSource(); if (source == null) { return;/*from ww w. j av a 2 s . c o m*/ } else if (eventI.getActionCommand().equals("Settings...")) { // Turn off pump if it is currently running resetGUI_EDT(); stopFilePumpWorkerThread(); // Let user edit settings pumpSettings.popupSettingsDialog(); if (pumpSettings.getBClickedOK()) { String errStr = pumpSettings.canPumpRun(); if (!errStr.isEmpty()) { JOptionPane.showMessageDialog(filePumpGuiFrame, errStr, "Settings error", JOptionPane.ERROR_MESSAGE); return; } // Update the main frame with the new settings updateMainFrame(); } } else if (eventI.getActionCommand().equals("Exit")) { exit(); } else if (source == endButton) { // Turn off pump if it is currently running resetGUI_EDT(); stopFilePumpWorkerThread(); // Create an "end.txt" file in the output directory // Make sure we can do this String errStr = pumpSettings.canPumpRun(); if (!errStr.isEmpty()) { JOptionPane.showMessageDialog(filePumpGuiFrame, new String("Settings error:\n" + errStr), "Settings error", JOptionPane.ERROR_MESSAGE); return; } filePumpWorker = new FilePumpWorker(this, pumpSettings, true); filePumpThread = new Thread(filePumpWorker); filePumpThread.start(); } else if (source == actionButton) { // Turn on or off streaming data if (actionButton.getText().equals("Start pump")) { // User wants to start outputting files; make sure we can do this String errStr = pumpSettings.canPumpRun(); if (!errStr.isEmpty()) { JOptionPane.showMessageDialog(filePumpGuiFrame, new String("Settings error:\n" + errStr), "Settings error", JOptionPane.ERROR_MESSAGE); return; } bPumpRunning = true; // Change label to "Stop pump" actionButton.setText("Stop pump"); actionButton.setBackground(Color.RED); // Start pump filePumpWorker = new FilePumpWorker(this, pumpSettings, false); filePumpThread = new Thread(filePumpWorker); filePumpThread.start(); } else { resetGUI_EDT(); stopFilePumpWorkerThread(); } } }
From source file:com.ivli.roim.controls.ChartControl.java
@Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); final XYPlot plot = getChart().getXYPlot(); switch (MENUS.translate(e.getActionCommand())) { case ADD:/*from www . j a v a 2 s. c om*/ if (null != iSeries && iSeries instanceof XYSeries) { addMarker(new DomainMarker(iDataItem.getXValue(), iSeries)); } break; case EXPORT_CSV: if (null != iSeries && iSeries instanceof XYSeries) { FileOpenDialog dlg = new FileOpenDialog( java.util.ResourceBundle.getBundle("com/ivli/roim/Bundle").getString("CHOICE_FILE_TO_OPEN"), "csv", //NOI18N "CSV file", //NOI18N false); if (dlg.doModal()) { try (Writer pwr = new PrintWriter(dlg.getFileName())) { //NOI18N for (int i = 0; i < iSeries.getItemCount(); ++i) { XYDataItem xy = iSeries.getDataItem(i); pwr.append(String.format("%f\t%f\n", xy.getXValue(), xy.getYValue())); //NOI18N } pwr.flush(); pwr.close(); } catch (IOException ex) { LOG.throwing(ex); } } } break; case MOVE_TO_MAX: iMarker.setValue(XYSeriesUtilities.getDomainValueOfMaximum(((DomainMarker) iMarker).getSeries())); break;//((DomainMarker)iMarker).moveToMaximum(DomainMarker.MOVETO.GLOBAL)); break; case MOVE_TO_MIN: iMarker.setValue(XYSeriesUtilities.getDomainValueOfMinimum(((DomainMarker) iMarker).getSeries())); break; case MOVE_TO_MEDIAN: { iMarker.setValue(XYSeriesUtilities.getDomainValueOfMaximum(((DomainMarker) iMarker).getSeries())); double medY = (iSeries.getMaxY() - iSeries.getMinY()) / 2.; double val = XYSeriesUtilities.getNearestX(iSeries, medY); if (Double.isFinite(val)) iMarker.setValue(val); } ; break; case DELETE: removeMarker((DomainMarker) iMarker); break; case DELETE_ALL: plot.getDomainMarkers(Layer.FOREGROUND).clear(); iInterpolations.stream().forEach((i) -> { i.close(); }); iInterpolations.clear(); break; case FIT_LEFT: case FIT_RIGHT: { final FITDIR dir = (MENUS.FIT_LEFT == MENUS.translate(e.getActionCommand()) ? FITDIR.FIT_LEFT : FITDIR.FIT_RIGHT); List<DomainMarker> list = (new ArrayList<DomainMarker>(plot.getDomainMarkers(Layer.FOREGROUND))) .stream().filter((DomainMarker m) -> { return ((DomainMarker) iMarker).getSeries() == m.getSeries(); }).sorted((DomainMarker aLhs, DomainMarker aRhs) -> { return (int) (aLhs.getValue() - aRhs.getValue()); }).collect(Collectors.toList()); LOG.debug("-->Found " + list.size() + " markers"); switch (list.size()) { case 0: break; case 1: iInterpolations.add(new Interpolation((DomainMarker) iMarker, dir)); break; case 2: //fallthrough as default default: { DomainMarker left = null, right = null; int ndx = list.indexOf(iMarker); if (dir == FITDIR.FIT_LEFT) { if (ndx >= 1) { right = (DomainMarker) iMarker; left = list.get(--ndx); iInterpolations.add(new Interpolation(left, right)); } else { iInterpolations.add(new Interpolation((DomainMarker) iMarker, dir)); } } else if (dir == FITDIR.FIT_RIGHT) { if (ndx < list.size() - 1) { right = list.get(++ndx); left = (DomainMarker) iMarker; iInterpolations.add(new Interpolation(left, right)); } else { iInterpolations.add(new Interpolation((DomainMarker) iMarker, dir)); } } } break; } } break; default: break; } dropSelection(); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.css.FerramentaCSSPanel.java
public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd == "Salvar") { salvar();//from ww w . j av a 2 s . co m } else if (cmd.equals("AbrirURL")) { abrirUrl(); } else if (cmd == "Abrir" || cmd.equals(MenuSilvinha.MNU_ABRIR)) { abrirArquivo(); } else if (cmd == "SaveAs") { salvarComo(); } else if (cmd == "Creditos") { new Creditos(); } else if (cmd == "Sair") { System.exit(0); } else if (cmd == "SelecionarTudo") { textAreaSourceCode.getTextPane().selectAll(); ferrCSSPanelNaoEditavel.textAreaSourceCode.getTextPane().selectAll(); } else if (cmd == "Desfazer") { textAreaSourceCode.undo(); reavalia(textAreaSourceCode.getText()); } else if (cmd == "AumentaFonte") { textAreaSourceCode.aumentaFontSize(); } else if (cmd == "DiminuiFonte") { textAreaSourceCode.diminuiFontSize(); } else if (cmd == "Contraste") { textAreaSourceCode.autoContraste(); reavalia(textAreaSourceCode.getText()); } }
From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java
/** * Handles an action event./* w w w . j av a 2 s.c o m*/ * * @param evt * the event. */ public void actionPerformed(ActionEvent evt) { try { String acmd = evt.getActionCommand(); if (acmd.equals(ACTION_CHART_ZOOM_BOX)) { setPanMode(false); } else if (acmd.equals(ACTION_CHART_PAN)) { setPanMode(true); } else if (acmd.equals(ACTION_CHART_ZOOM_IN)) { ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo(); Rectangle2D rect = info.getPlotInfo().getDataArea(); zoomBoth(rect.getCenterX(), rect.getCenterY(), ZOOM_FACTOR); } else if (acmd.equals(ACTION_CHART_ZOOM_OUT)) { ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo(); Rectangle2D rect = info.getPlotInfo().getDataArea(); zoomBoth(rect.getCenterX(), rect.getCenterY(), 1 / ZOOM_FACTOR); } else if (acmd.equals(ACTION_CHART_ZOOM_TO_FIT)) { // X-axis (has no fixed borders) chartPanel.autoRangeHorizontal(); Plot plot = chartPanel.getChart().getPlot(); if (plot instanceof ValueAxisPlot) { XYPlot vvPlot = (XYPlot) plot; ValueAxis axis = vvPlot.getRangeAxis(); if (axis != null) { axis.setLowerBound(yMin); axis.setUpperBound(yMax); } } } else if (acmd.equals(ACTION_CHART_EXPORT)) { try { chartPanel.doSaveAs(); } catch (IOException i) { MsgBox.error(i.getMessage()); } } else if (acmd.equals(ACTION_CHART_PRINT)) { chartPanel.createChartPrintJob(); } else if (acmd.equals(ACTION_CHART_PROPERTIES)) { ChartPropertyEditPanel panel = new ChartPropertyEditPanel(jFreeChart); int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { panel.updateChartProperties(jFreeChart); } } } catch (Exception e) { MsgBox.error(e.getMessage()); } }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd == "Salvar") { salvaAlteracoes.salvar();/* w ww . j a v a2 s .c om*/ /* * 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; newCod = controle.corrige(texto.getText(), erroAtual); textAreaSourceCode.setText(newCod); salvaAlteracoes.setAlterado(); TxtBuffer.setContent(textAreaSourceCode.getText()); reavalia(newCod); textAreaSourceCode.getTextPane().setCaretPosition(pos); controle.avalia(textAreaSourceCode.getText(), true); } } else if (cmd == "AbrirURL") { String url; url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://"); avaliaUrl(url); } 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 == "SelecionarTudo") { textAreaSourceCode.getTextPane().selectAll(); } else if (cmd == "Desfazer") { textAreaSourceCode.undo(); // System.out.println("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 == "Cancelar") { salvaAlteracoes.cancelar(); } }
From source file:de.tor.tribes.ui.views.DSWorkbenchNotepad.java
@Override public void actionPerformed(ActionEvent e) { NoteTableTab activeTab = getActiveTab(); if (e.getActionCommand() != null && activeTab != null) { if (e.getActionCommand().equals("Copy")) { activeTab.transferSelection(NoteTableTab.TRANSFER_TYPE.COPY_TO_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("BBCopy")) { activeTab.transferSelection(NoteTableTab.TRANSFER_TYPE.CLIPBOARD_BB); } else if (e.getActionCommand().equals("BBCopy_Village")) { activeTab.copyVillagesAsBBCodes(); } else if (e.getActionCommand().equals("Cut")) { activeTab.transferSelection(NoteTableTab.TRANSFER_TYPE.CUT_TO_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("Paste")) { activeTab.transferSelection(NoteTableTab.TRANSFER_TYPE.FROM_INTERNAL_CLIPBOARD); } else if (e.getActionCommand().equals("Delete")) { activeTab.deleteSelection(true); } else if (e.getActionCommand().equals("Delete_Village")) { activeTab.deleteVillagesFromNotes(); } else 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 w w . j a v a 2s. com*/ g.dispose(); TexturePaint paint = new TexturePaint(back, new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight())); jxSearchPane.setBackgroundPainter(new MattePainter(paint)); jxSearchPane.setVisible(true); } } }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDB.java
private JPanel createButtonsPanel() { JPanel panelButtons = new JPanel(); panelButtons// w ww. j a v a2 s. c o m .setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5), null)); panelButtons.setLayout(new BorderLayout()); /* regular Buttons panel...*/ JPanel panelRegularButtons = new JPanel(); panelRegularButtons.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); panelRegularButtons.setLayout(new FlowLayout()); buttonSelect = new JButton(Localizer.get("DialogIMDB.button.select.text")); //$NON-NLS-1$ buttonSelect.setToolTipText(Localizer.get("DialogIMDB.button.select.tooltip")); //$NON-NLS-1$ buttonSelect.setActionCommand("GetIMDBInfo - Select"); //$NON-NLS-1$ buttonSelect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$ if (!getMoviesList().isSelectionEmpty()) executeCommandSelect(); } }); panelRegularButtons.add(buttonSelect); // Search button buttonSearch = new JButton(Localizer.get("DialogIMDbMultiAdd.button.search.text")); //$NON-NLS-1$ buttonSearch.setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.search.tooltip")); //$NON-NLS-1$ buttonSearch.setActionCommand("GetIMDBInfo - Search again"); //$NON-NLS-1$ buttonSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$ executeSearch(); } }); panelRegularButtons.add(buttonSearch); // cancel button buttonCancel = new JButton(Localizer.get("DialogIMDB.button.cancel.text.cancel")); //$NON-NLS-1$ buttonCancel.setToolTipText(Localizer.get("DialogIMDB.button.cancel.tooltip.cancel")); //$NON-NLS-1$ buttonCancel.setActionCommand("GetIMDBInfo - Cancel"); //$NON-NLS-1$ buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$ canceled = true; dispose(); } }); panelRegularButtons.add(buttonCancel); panelButtons.add(panelRegularButtons, BorderLayout.SOUTH); return panelButtons; }
From source file:de.tor.tribes.ui.views.DSWorkbenchTagFrame.java
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Paste")) { pasteVillagesFromClipboard();/*from w w w . j av a 2s . c om*/ } else if (e.getActionCommand().equals("BBCopy")) { transferSelectedTagsAsBBCodesToClipboard(); } else if (e.getActionCommand().equals("BBCopy_Village")) { copyVillageAsBBCode(); } else if (e.getActionCommand().equals("Delete")) { if (e.getSource() != null) { if (jTagsTable.hasFocus()) { removeSelectedTags(); } else { untagSelectedVillages(); } } } }
From source file:com.hexidec.ekit.action.ListAutomationAction.java
public void actionPerformed(ActionEvent ae) { try {/* ww w .j a va 2 s. co m*/ JEditorPane jepEditor = (JEditorPane) (parentEkit.getTextPane()); String selTextBase = jepEditor.getSelectedText(); int textLength = -1; if (selTextBase != null) { textLength = selTextBase.length(); } if (selTextBase == null || textLength < 1) { int pos = parentEkit.getCaretPosition(); parentEkit.setCaretPosition(pos); if (ae.getActionCommand() != "newListPoint") { if (htmlUtilities.checkParentsTag(HTML.Tag.OL) || htmlUtilities.checkParentsTag(HTML.Tag.UL)) { revertList(htmlUtilities.getListItemContainer()); return; } } String sListType = (baseTag == HTML.Tag.OL ? "ol" : "ul"); StringBuffer sbNew = new StringBuffer(); if (htmlUtilities.checkParentsTag(baseTag)) { sbNew.append("<li></li>"); insertHTML(parentEkit.getTextPane(), parentEkit.getExtendedHtmlDoc(), parentEkit.getTextPane().getCaretPosition(), sbNew.toString(), 0, 0, HTML.Tag.LI); } else { boolean isLast = false; int caretPos = parentEkit.getCaretPosition(); if (caretPos == parentEkit.getExtendedHtmlDoc().getLength()) { isLast = true; } sbNew.append("<" + sListType + "><li></li></" + sListType + ">" + (isLast ? "<p style=\"margin-top: 0\"> </p>" : "")); insertHTML(parentEkit.getTextPane(), parentEkit.getExtendedHtmlDoc(), parentEkit.getTextPane().getCaretPosition(), sbNew.toString(), 0, 0, (sListType.equals("ol") ? HTML.Tag.OL : HTML.Tag.UL)); if (true) { parentEkit.setCaretPosition(caretPos + 1); } } parentEkit.refreshOnUpdate(); } else { if (htmlUtilities.checkParentsTag(HTML.Tag.OL) || htmlUtilities.checkParentsTag(HTML.Tag.UL)) { revertList(htmlUtilities.getListItemContainer()); return; } else { String sListType = (baseTag == HTML.Tag.OL ? "ol" : "ul"); HTMLDocument htmlDoc = (HTMLDocument) (jepEditor.getDocument()); int iStart = jepEditor.getSelectionStart(); int iEnd = jepEditor.getSelectionEnd(); String selText = htmlDoc.getText(iStart, iEnd - iStart); /* for(int ch = 0; ch < selText.length(); ch++) { Element elem = htmlDoc.getCharacterElement(iStart + ch); log.debug("elem " + ch + ": " + elem.getName()); log.debug("char " + ch + ": " + selText.charAt(ch) + " [" + Character.getNumericValue(selText.charAt(ch)) + "]"); if(Character.getNumericValue(selText.charAt(ch)) < 0) { log.debug(" is space? " + ((selText.charAt(ch) == '\u0020') ? "YES" : "---")); log.debug(" is return? " + ((selText.charAt(ch) == '\r') ? "YES" : "---")); log.debug(" is newline? " + ((selText.charAt(ch) == '\n') ? "YES" : "---")); log.debug(" is nextline? " + ((selText.charAt(ch) == '\u0085') ? "YES" : "---")); log.debug(" is linesep? " + ((selText.charAt(ch) == '\u2028') ? "YES" : "---")); log.debug(" is parasep? " + ((selText.charAt(ch) == '\u2029') ? "YES" : "---")); log.debug(" is verttab? " + ((selText.charAt(ch) == '\u000B') ? "YES" : "---")); log.debug(" is formfeed? " + ((selText.charAt(ch) == '\u000C') ? "YES" : "---")); } } */ StringBuffer sbNew = new StringBuffer(); sbNew.append("<" + sListType + ">"); // tokenize on known linebreaks if present, otherwise manually parse on <br> break tags if ((selText.indexOf("\r") > -1) || (selText.indexOf("\n") > -1)) { String sToken = ((selText.indexOf("\r") > -1) ? "\r" : "\n"); StringTokenizer stTokenizer = new StringTokenizer(selText, sToken); while (stTokenizer.hasMoreTokens()) { sbNew.append("<li>"); sbNew.append(stTokenizer.nextToken()); sbNew.append("</li>"); } } else { StringBuffer sbItem = new StringBuffer(); for (int ch = 0; ch < selText.length(); ch++) { String elem = (htmlDoc.getCharacterElement(iStart + ch) != null ? htmlDoc.getCharacterElement(iStart + ch).getName().toLowerCase() : "[null]"); if (elem.equals("br") && sbItem.length() > 0) { sbNew.append("<li>"); sbNew.append(sbItem.toString()); sbNew.append("</li>"); sbItem.delete(0, sbItem.length()); } else { sbItem.append(selText.charAt(ch)); } } } sbNew.append("</" + sListType + ">"); htmlDoc.remove(iStart, iEnd - iStart); insertHTML(jepEditor, htmlDoc, iStart, sbNew.toString(), 1, 1, null); } } } catch (BadLocationException ble) { } }