Example usage for java.awt.event ActionEvent getActionCommand

List of usage examples for java.awt.event ActionEvent getActionCommand

Introduction

In this page you can find the example usage for java.awt.event ActionEvent getActionCommand.

Prototype

public String getActionCommand() 

Source Link

Document

Returns the command string associated with this action.

Usage

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.objeto.PainelObjeto.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Procurar") {
        scrollPaneDescricao.buscar();/*from   w  w  w.j a  v a  2 s. c o  m*/
    } else

    if (cmd == "SaveAs") {
        salvaAlteracoes.salvarComo();
        // salvarComo();
    } else if (cmd == "AbrirURL") {
        abreUrl();
    } else if (cmd == "Sair") {
        salvaAlteracoes.sair();
    }

    else

    if (cmd == "Salvar") {
        salvaAlteracoes.salvar();

    } else if (cmd == "Abrir") {
        // abrirArquivo();
        Abrir();

    } else if (cmd == "AbrirURL") {
        abreUrl();
    } else if (cmd.equals("SelecionarTudo")) {
        scrollPaneDescricao.getTextPane().selectAll();
        scrollPaneDescricao.getTextPane().requestFocus();
    } else if (cmd == "SaveAs") {
        salvaAlteracoes.salvarComo();
        // salvarComo();
    } else if (cmd == "Sair") {
        salvaAlteracoes.sair();
    } else if (cmd == "Creditos") {
        new Creditos();
    } else if (cmd == "Desfazer") {
        // boxCode.undo();
        // boxCode.coloreSource();
        // reavalia(boxCode.getText());
    } else if (cmd == "AumentaFonte") {
        scrollPaneDescricao.aumentaFontSize();
    } else if (cmd == "DiminuiFonte") {
        scrollPaneDescricao.diminuiFontSize();
    } else if (cmd == "Contraste") {
        scrollPaneDescricao.autoContraste();

        int selectedStart = 0;
        int selectedEnd = 0;
        int corretordePosicoesdoLabel = 0;
        int corretordePosicoesdoControle = 0;
        ArrayList<Integer> ordenador = new ArrayList<Integer>();
        ArrayList<String> conteudoParticRotuloOrdenado = new ArrayList<String>();
        conteudoParticRotulo = null;
        conteudoParticRotulo = tArParticipRotulo.getTextoEPos();
        String[] conteudo = new String[3];
        String codHTML = scrollPaneDescricao.getTextPane().getText().replace("\r", "");
        // System.out.println(codHTML.substring((Integer) (getPosTagRepEnd()
        // + corretordePosicoesdoControle - 1), (getPosTagRepEnd() +
        // corretordePosicoesdoControle - 1) + 36));

        while (codHTML.indexOf("SIL" + inicial) != -1) {
            inicial++;
        }

        ColorModel cm = tArParticipRotulo.getColorModel();

        for (String conteudoPR : conteudoParticRotulo) {
            conteudo = conteudoPR.split("@");
            ordenador.add(Integer.parseInt(conteudo[1]));
        }

        int[] ordem = new int[ordenador.size()];
        for (int i = 0; i < ordem.length; i++) {
            ordem[i] = ordenador.get(i);
        }

        Arrays.sort(ordem);

        for (int i = 0; i < ordem.length; i++) {
            for (String conteudoPR : conteudoParticRotulo) {
                conteudo = conteudoPR.split("@");

                if (Integer.parseInt(conteudo[1]) == ordem[i]) {
                    conteudoParticRotuloOrdenado.add(conteudoPR);
                }

            }
        }
        for (String conteudoPR : conteudoParticRotuloOrdenado) {
            conteudo = conteudoPR.split("@");

            // System.out.println("posico: " +
            // Integer.parseInt(conteudo[1]));

        }

        for (String conteudoPR : conteudoParticRotuloOrdenado) {

            conteudo = conteudoPR.split("@");
            conteudo[0] = "<label for=\"SIL" + inicial + "\">" + conteudo[0] + "</label>";
            selectedStart = Integer.parseInt(conteudo[1]) + corretordePosicoesdoLabel;
            selectedEnd = Integer.parseInt(conteudo[2]) + corretordePosicoesdoLabel;
            // corretordePosicoesdoLabel += ("<label for=\"SIL" + inicial +
            // "\"></label>").length();

            if ((selectedStart < getPosTagRepInit() + corretordePosicoesdoLabel)) {
                corretordePosicoesdoControle = corretordePosicoesdoLabel;

            }
            /*
             * if((selectedStart>getPosTagRepInit()+corretordePosicoesdoLabel)){
             * //arTextPainelCorrecao.select(selectedStart+("id=x").length(),
             * selectedEnd+("id=x").length());
             * 
             * }else{ }
             */
            // scrollPaneCorrecaoLabel.getTextPane().select(selectedStart,
            // selectedEnd);
            // arTextPainelCorrecao.setTextoParaSelecionado(conteudo[0]);
            arTextPainelCorrecao.setASet(arTextPainelCorrecao.getSc().addAttributes(SimpleAttributeSet.EMPTY,
                    SimpleAttributeSet.EMPTY));
            scrollPaneDescricao.getTextPane().select(selectedStart, selectedEnd);
            arTextPainelCorrecao.setColorForSelectedText(new Color(255, 204, 102), new Color(0, 0, 0));
            scrollPaneDescricao.getTextPane().setCharacterAttributes(arTextPainelCorrecao.getASet(), false);

        }

        // arTextPainelCorrecao.formataHTML();
        // tArParticipRotulo.apagaTexto();

        TabelaDescricao tcl = tableLinCod;
        int linha = (Integer) dtm.getValueAt(tcl.getSelectedRow(), 0);
        int coluna = (Integer) dtm.getValueAt(tcl.getSelectedRow(), 1);
        int endTag = 0;
        int posAtual = 0;
        int posFinal = 0;
        codHTML = scrollPaneDescricao.getTextPane().getText().replace("\r", "");
        int i;
        for (i = 0; i < (linha - 1); i++) {
            posAtual = codHTML.indexOf("\n", posAtual + 1);
        }
        i = 0;
        // gambiarra provisria
        posFinal = codHTML.indexOf((String) dtm.getValueAt(tcl.getSelectedRow(), 2), posAtual + coluna);
        while (codHTML.charAt(posFinal + i) != '>') {
            i++;
        }

        setPosTagRepInit(posFinal);
        setPosTagRepEnd(posFinal + i + 1);

        scrollPaneDescricao.goToLine(linha);
        scrollPaneDescricao.getTextPane().select(getPosTagRepInit(), getPosTagRepEnd());

        arTextPainelCorrecao.setColorForSelectedText(Color.decode("0xEEEEEE"), new Color(255, 0, 0));
        arTextPainelCorrecao.setUnderline();
        // TODO Auto-generated method stub
        // tArParticipRotulo.apagaTexto();

    }

}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();

    if (cmd == "Salvar") {
        System.out.println("action Salvar");
        salvaAlteracoes.salvar();/* w ww.j  a  v a 2  s .com*/

    } else if (cmd == "Abrir") {
        // abrirArquivo();

        abrir();
    } else if (cmd.equals("SelecionarTudo")) {
        textAreaSourceCode.getTextPane().selectAll();
        textAreaSourceCode.getTextPane().requestFocus();
    } else if (cmd == "AbrirURL") {
        abreUrl();

    } else if (cmd == "SaveAs") {
        salvaAlteracoes.salvarComo();
    } else if (cmd == "Creditos") {
        new Creditos();
    } else if (cmd == "Sair") {
        salvaAlteracoes.sair();
    } else if (cmd == "Desfazer") {
        // boxCode.undo();
        // boxCode.coloreSource();
        // reavalia(boxCode.getText());
    } else if (cmd == "AumentaFonte") {
        textAreaSourceCode.aumentaFontSize();
    } else if (cmd == "DiminuiFonte") {
        textAreaSourceCode.diminuiFontSize();
    } else if (cmd == "Contraste") {
        textAreaSourceCode.autoContraste();

        int selectedStart = 0;
        int selectedEnd = 0;
        int corretordePosicoesdoLabel = 0;
        int corretordePosicoesdoControle = 0;
        ArrayList<Integer> ordenador = new ArrayList<Integer>();
        ArrayList<String> conteudoParticRotuloOrdenado = new ArrayList<String>();
        conteudoParticRotulo = null;
        conteudoParticRotulo = tArParticipRotulo.getTextoEPos();
        String[] conteudo = new String[3];
        String codHTML = textAreaSourceCode.getTextPane().getText().replace("\r", "");
        System.out.println(codHTML.substring((Integer) (getPosTagRepEnd() + corretordePosicoesdoControle - 1),
                (getPosTagRepEnd() + corretordePosicoesdoControle - 1) + 36));

        while (codHTML.indexOf("SIL" + inicial) != -1) {
            inicial++;
        }

        ColorModel cm = tArParticipRotulo.getColorModel();

        for (String conteudoPR : conteudoParticRotulo) {
            conteudo = conteudoPR.split("@");
            ordenador.add(Integer.parseInt(conteudo[1]));
        }

        int[] ordem = new int[ordenador.size()];
        for (int i = 0; i < ordem.length; i++) {
            ordem[i] = ordenador.get(i);
        }

        Arrays.sort(ordem);

        for (int i = 0; i < ordem.length; i++) {
            for (String conteudoPR : conteudoParticRotulo) {
                conteudo = conteudoPR.split("@");

                if (Integer.parseInt(conteudo[1]) == ordem[i]) {
                    conteudoParticRotuloOrdenado.add(conteudoPR);
                }

            }
        }
        for (String conteudoPR : conteudoParticRotuloOrdenado) {
            conteudo = conteudoPR.split("@");

            System.out.println("posico: " + Integer.parseInt(conteudo[1]));

        }

        for (String conteudoPR : conteudoParticRotuloOrdenado) {

            conteudo = conteudoPR.split("@");
            conteudo[0] = "<label for=\"SIL" + inicial + "\">" + conteudo[0] + "</label>";
            selectedStart = Integer.parseInt(conteudo[1]) + corretordePosicoesdoLabel;
            selectedEnd = Integer.parseInt(conteudo[2]) + corretordePosicoesdoLabel;
            // corretordePosicoesdoLabel += ("<label for=\"SIL" + inicial +
            // "\"></label>").length();

            if ((selectedStart < getPosTagRepInit() + corretordePosicoesdoLabel)) {
                corretordePosicoesdoControle = corretordePosicoesdoLabel;

            }
            /*
             * if((selectedStart>getPosTagRepInit()+corretordePosicoesdoLabel)){
             * //arTextPainelCorrecao.select(selectedStart+("id=x").length(),
             * selectedEnd+("id=x").length());
             * 
             * }else{ }
             */
            // scrollPaneCorrecaoLabel.getTextPane().select(selectedStart,
            // selectedEnd);
            // arTextPainelCorrecao.setTextoParaSelecionado(conteudo[0]);
            arTextPainelCorrecao.setASet(arTextPainelCorrecao.getSc().addAttributes(SimpleAttributeSet.EMPTY,
                    SimpleAttributeSet.EMPTY));
            textAreaSourceCode.getTextPane().select(selectedStart, selectedEnd);
            arTextPainelCorrecao.setColorForSelectedText(new Color(255, 204, 102), new Color(0, 0, 0));
            textAreaSourceCode.getTextPane().setCharacterAttributes(arTextPainelCorrecao.getASet(), false);

        }

        // arTextPainelCorrecao.formataHTML();
        // tArParticipRotulo.apagaTexto();

        TabelaCorrecaoLabel tcl = tableLinCod;
        int linha = (Integer) dtm.getValueAt(tcl.getSelectedRow(), 0);
        int coluna = (Integer) dtm.getValueAt(tcl.getSelectedRow(), 1);
        int endTag = 0;
        int posAtual = 0;
        int posFinal = 0;
        codHTML = textAreaSourceCode.getTextPane().getText().replace("\r", "");
        int i;
        for (i = 0; i < (linha - 1); i++) {
            posAtual = codHTML.indexOf("\n", posAtual + 1);
        }
        i = 0;
        // gambiarra provisria
        posFinal = codHTML.indexOf((String) dtm.getValueAt(tcl.getSelectedRow(), 2), posAtual + coluna);
        while (codHTML.charAt(posFinal + i) != '>') {
            i++;
        }

        setPosTagRepInit(posFinal);
        setPosTagRepEnd(posFinal + i + 1);

        textAreaSourceCode.goToLine(linha);
        textAreaSourceCode.getTextPane().select(getPosTagRepInit(), getPosTagRepEnd());

        arTextPainelCorrecao.setColorForSelectedText(Color.decode("0xEEEEEE"), new Color(255, 0, 0));
        arTextPainelCorrecao.setUnderline();
        // TODO Auto-generated method stub
        // tArParticipRotulo.apagaTexto();

    }

}

From source file:org.gumtree.vis.awt.JChartPanel.java

@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals(REMOVE_SELECTED_MASK_COMMAND)) {
        removeSelectedMask();//from ww w  .  j av  a  2s  .co  m
        repaint();
    } else if (command.equals(DESELECT_MASK_COMMAND)) {
        selectMask(Double.NaN, Double.NaN);
        repaint();
    } else if (command.equals(ADD_INTERNAL_MARKER_COMMAND)) {
        addInternalMarker(event);
        repaint();
    } else if (command.equals(ADD_HORIZONTAL_BAR_COMMAND)) {
        addHorizontalBar(event);
        repaint();
    } else if (command.equals(ADD_VERTICAL_BAR_COMMAND)) {
        addVerticalBar(event);
        repaint();
    } else if (command.equals(REMOVE_SELECTED_MARKER_COMMAND)) {
        removeSelectedMarker();
    } else if (command.equals(CLEAR_INTERNAL_MARKERS_COMMAND)) {
        clearMarkers();
    } else if (command.equals(CLEAR_DOMAIN_MARKERS_COMMAND)) {
        clearDomainAxisMarkers();
    } else if (command.equals(CLEAR_RANGE_MARKERS_COMMAND)) {
        clearRangeAxisMarkers();
    } else if (command.equals(CLEAR_ALL_MARKERS_COMMAND)) {
        clearAllMarkers();
    } else if (command.startsWith(SELECT_MASK_COMMAND)) {
        String[] commands = command.split("-", 2);
        if (commands.length > 1) {
            selectMask(commands[1]);
            repaint();
        }
    } else {
        super.actionPerformed(event);
    }
}

From source file:canreg.client.gui.dataentry.PDSEditorInternalFrame.java

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getSource().getClass() == FastFilterInternalFrame.class) {
        filterTextField.setText(e.getActionCommand());
    }//from w  w w .j  ava2  s.co m
}

From source file:com.sshtools.sshterm.SshTerminalPanel.java

public void actionPerformed(ActionEvent event) {
    // Get the name of the action command
    String command = event.getActionCommand();

    if (sessionActions.containsKey(event.getActionCommand())) {
        SessionProviderAction action = (SessionProviderAction) sessionActions.get(event.getActionCommand());
        SessionProviderFrame frame;//from   ww  w.  j  av a2 s .c  o m
        // Do we have an existing frame?
        for (Iterator it = sessionFrames.iterator(); it.hasNext();) {
            frame = (SessionProviderFrame) it.next();
            if (action.getProvider().getProviderClass().isInstance(frame.getSessionPanel())
                    && frame.getSessionPanel().singleFrame()) {
                frame.show();
                return;
            }
        }

        try {
            frame = new SessionProviderFrame(getCurrentConnectionProfile(), ssh, action.getProvider());
            if (frame.initFrame(getApplication())) {
                frame.show();
                sessionFrames.add(frame);
            }

        } catch (Throwable ex) {
            ex.printStackTrace();
        }
    }
    /*if ((shiftAction != null)
        && command.equals(shiftAction.getActionCommand())) {
      //boolean error = false;
        try {
          SessionProviderFrame browserFrame = new SessionProviderFrame(
         getCurrentConnectionProfile(),
                                ssh,
         SessionProviderFactory.getInstance().getProvider("shift"));
          if (PreferencesStore.preferenceExists(PREF_SHIFT_GEOMETRY)) {
    browserFrame.setBounds(PreferencesStore.getRectangle(
        PREF_SHIFT_GEOMETRY, browserFrame.getBounds()));
          }
          else {
    browserFrame.setLocation(40, 40);
          }
          browserFrame.init(getApplication());
          browserFrame.show();
          browserFrames.add(browserFrame);
        }
        catch (Exception e) {
          showExceptionMessage("Error", e.getMessage());
        }
      }
      /*if (browserFrame != null) {
         //  We need to go back to windowed mode if in full screen mode
         if (!browserFrame.isVisible()) {
           setFullScreenMode(false);
         }
         browserFrame.setVisible(!browserFrame.isVisible());
       }*/

    /* if ( (tunnelingAction != null)
         && command.equals(tunnelingAction.getActionCommand())) {
         try {
    if(tunnelingFrame==null) {
    tunnelingFrame = new SessionProviderFrame(
         getCurrentConnectionProfile(),
                                  ssh,
         SessionProviderFactory.getInstance().getProvider("tunneling"));
    /*if (PreferencesStore.preferenceExists(PREF_SHIFT_GEOMETRY)) {
       tunnelingFrame.setBounds(PreferencesStore.getRectangle(
           PREF_SHIFT_GEOMETRY, tunnelingFrame.getBounds()));
     }
     else {
       tunnelingFrame.setLocation(40, 40);
     }*/

    /*      }
    tunnelingFrame.init(getApplication());
    tunnelingFrame.show();
        }
        catch (Exception e) {
    showExceptionMessage("Error", e.getMessage());
        }*/

    /*if (portForwardingDialog == null) {
         Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class,
     this);
       if (parent instanceof JFrame) {
         portForwardingDialog = new JDialog( (JFrame) parent,
                                      "Port Forwarding", false);
       }
       else if (parent instanceof JDialog) {
         portForwardingDialog = new JDialog( (JDialog) parent,
                                      "Port Forwarding", false);
       }
       else {
         portForwardingDialog = new JDialog( (JFrame)null,
                                      "Port Forwarding", false);
       }
       portForwardingDialog.getContentPane().setLayout(new BorderLayout());
       portForwardingDialog.getContentPane().add(portForwardingPane,
                                           BorderLayout.CENTER);
       portForwardingDialog.pack();
       if (PreferencesStore.preferenceExists(
     PREF_PORT_FORWARDING_GEOMETRY)) {
         portForwardingDialog.setBounds(PreferencesStore
                                  .getRectangle(
       PREF_PORT_FORWARDING_GEOMETRY,
       portForwardingDialog.getBounds()));
       }
       else {
         portForwardingDialog.setLocation(40, 40);
         portForwardingDialog.setSize(new Dimension(260, 420));
       }
       PreferencesStore.restoreTableMetrics(portForwardingPane
                                      .getPortForwardingTable(),
     PREF_PORT_FORWARDING_FORWARDS_TABLE_METRICS,
     new int[] {68, 62, 44, 54, 98, 78});
       PreferencesStore.restoreTableMetrics(portForwardingPane.
                                      getActiveChannelPane()
                                      .getActiveChannelTable(),
     PREF_PORT_FORWARDING_ACTIVE_TABLE_METRICS,
     new int[] {22, 22, 92, 264});
       if (PreferencesStore.preferenceExists(
     PREF_PORT_FORWARDING_DIVIDER_LOCATION)) {
         portForwardingPane.setDividerLocation(PreferencesStore
                                         .getInt(
       PREF_PORT_FORWARDING_DIVIDER_LOCATION, 100));
       }
       else {
         portForwardingPane.setDividerLocation(0.75d);
       }
     }
     //  We need to go back to windowed mode if in full screen mode
     if (!portForwardingDialog.isVisible()) {
       setFullScreenMode(false);
     }
     portForwardingDialog.setVisible(!portForwardingDialog.isVisible());*/
    //}

    if ((stopAction != null) && command.equals(stopAction.getActionCommand())) {
        stopRecording();
    }

    if ((recordAction != null) && command.equals(recordAction.getActionCommand())) {
        //  We need to go back to windowed mode if in full screen mode
        setFullScreenMode(false);

        // Select the file to record to
        JFileChooser fileDialog = new JFileChooser(System.getProperty("user.home"));
        int ret = fileDialog.showSaveDialog(this);

        if (ret == fileDialog.APPROVE_OPTION) {
            recordingFile = fileDialog.getSelectedFile();

            if (recordingFile.exists()
                    && (JOptionPane.showConfirmDialog(this, "File exists. Are you sure?", "File exists",
                            JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION)) {
                return;
            }

            try {
                recordingOutputStream = new FileOutputStream(recordingFile);
                statusBar.setStatusText("Recording to " + recordingFile.getName());
                setAvailableActions();
            } catch (IOException ioe) {
                showExceptionMessage("Error", "Could not open file for recording\n\n" + ioe.getMessage());
            }
        }
    }

    if ((playAction != null) && command.equals(playAction.getActionCommand())) {
        //  We need to go back to windowed mode if in full screen mode
        setFullScreenMode(false);

        // Select the file to record to
        JFileChooser fileDialog = new JFileChooser(System.getProperty("user.home"));
        int ret = fileDialog.showOpenDialog(this);

        if (ret == fileDialog.APPROVE_OPTION) {
            File playingFile = fileDialog.getSelectedFile();
            InputStream in = null;

            try {
                statusBar.setStatusText("Playing from " + playingFile.getName());
                in = new FileInputStream(playingFile);

                byte[] b = null;
                int a = 0;

                while (true) {
                    a = in.available();

                    if (a == -1) {
                        break;
                    }

                    if (a == 0) {
                        a = 1;
                    }

                    b = new byte[a];
                    a = in.read(b);

                    if (a == -1) {
                        break;
                    }

                    //emulation.write(b);
                    emulation.getOutputStream().write(b);
                }

                statusBar.setStatusText("Finished playing " + playingFile.getName());
                setAvailableActions();
            } catch (IOException ioe) {
                statusBar.setStatusText("Error playing " + playingFile.getName());
                showExceptionMessage("Error", "Could not open file for playback\n\n" + ioe.getMessage());
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException ioe) {
                        log.error(ioe);
                    }
                }
            }
        }
    }

    if ((newAction != null) && command.equals(newAction.getActionCommand())) {
        setFullScreenMode(false);

        // Clear the screen
        emulation.clearScreen();
        emulation.setCursorPosition(0, 0);

        // Force a repaint
        terminal.refresh();

        SshToolsConnectionProfile p = SshToolsConnectionPanel.showConnectionDialog(this,
                getCurrentConnectionProfile(), getAdditionalConnectionTabs());

        if (p != null) {
            currentConnectionProfile = p;
            setContainerTitle(null);
            setNeedSave(true);
            connect(p, true);
        } else {
            log.info("New connection cancelled");
        }

        return;
    }

    if ((closeAction != null) && command.equals(closeAction.getActionCommand())) {
        if (ssh != null) {
            if (performVerifiedDisconnect(true)) {
                disconnecting = true;
                ssh.disconnect();
            }
        }
    }

    if ((openAction != null) && command.equals(openAction.getActionCommand())) {
        open();
    }

    if ((saveAction != null) && command.equals(saveAction.getActionCommand())) {
        // Make sure we dont have a null connection object
        saveConnection(false);
    }

    if ((saveAsAction != null) && command.equals(saveAsAction.getActionCommand())) {
        saveConnection(true);
    }

    //  Keygen
    if ((keygenAction != null) && event.getActionCommand().equals(keygenAction.getActionCommand())) {
        if (keygenFrame == null) {
            keygenFrame = new com.sshtools.common.keygen.Main();
            keygenFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            keygenFrame.pack();
            UIUtil.positionComponent(SwingConstants.CENTER, keygenFrame);
        }

        if (!keygenFrame.isVisible()) {
            setFullScreenMode(false);
        }

        keygenFrame.setVisible(!keygenFrame.isVisible());
    }

    //GSI options
    if ((proxyInfoAction != null) && command.equals(proxyInfoAction.getActionCommand())) {
        ProxyHelper.showProxyInfo(getContainer().getWindow());
    }
    if ((proxyDestroyAction != null) && command.equals(proxyDestroyAction.getActionCommand())) {
        ProxyHelper.destroyProxy();
        setAvailableActions();
    }
}

From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

public void actionPerformed(ActionEvent e) {
    COSMOSAC cosmosac = (COSMOSAC) modelBox.getSelectedItem();
    if (modelBox == e.getSource()) {

        chargeHB.setText(Double.toString(cosmosac.getCHB()));
        ignoreSGButton.setSelected(cosmosac.isIgnoreSG());
        sigmaHB.setText(Double.toString(cosmosac.getSigmaHB()));
        sigmaHB2.setText(Double.toString(cosmosac.getSigmaHB2()));
        sigmaHB3.setText(Double.toString(cosmosac.getSigmaHB3()));
        sigmaDisp.setText(Double.toString(cosmosac.getSigmaDisp()));
        chargeDisp.setText(Double.toString(cosmosac.getCDisp()));
        beta.setText(Double.toString(cosmosac.getBeta()));
        fpol.setText(Double.toString(cosmosac.getFpol()));
        anorm.setText(Double.toString(cosmosac.getAnorm()));
    } else if (ignoreSGButton == e.getSource()) {
        cosmosac.setIgnoreSG(ignoreSGButton.isSelected());
    } else if (removeButton == e.getSource()) {
        //This method can be called only if
        //there's a valid selection
        //so go ahead and remove whatever's selected.
        int index = list.getSelectedIndex();
        listModel.remove(index);//from  w  w  w  . j a  v a 2  s .  co  m

        int size = listModel.getSize();

        if (size == 0) { //Nobody's left, disable firing.
            visibRemove(false);

        } else { //Select an index.
            if (index == listModel.getSize()) {
                //removed item in last position
                index--;
            }

            list.setSelectedIndex(index);
            list.ensureIndexIsVisible(index);
        }
    } else if (e.getActionCommand() == QUIT) {
        setVisible(false);
        db.fini();
        System.exit(0);
    }
    if (e.getActionCommand() == ABOUT) {
        new AboutDialog(this);
    }
}

From source file:com.att.aro.main.GraphPanel.java

/**
 * This method is invoked when an ActionEvent occurs in the GraphPanel.
 *///from   ww w.  j  ava  2s  .  c om
public void actionPerformed(ActionEvent e) {
    if (SAVE_AS_ACTION.equals(e.getActionCommand())) {
        try {
            saveAs();
        } catch (IOException e1) {
            JOptionPane.showMessageDialog(this, rb.getString("chart.saveError"));
            logger.fine("An error occurred trying to save the chart: " + e1.getMessage());
        }
    } else if (ZOOM_IN_ACTION.equals(e.getActionCommand())) {
        zoomIn();
    } else if (ZOOM_OUT_ACTION.equals(e.getActionCommand())) {
        zoomOut();
    }
}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Handles action events generated by the popup menu.
 * /* w  ww.j  a  va  2  s.co m*/
 * @param event
 *            the event.
 */
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();

    // many of the zoom methods need a screen location - all we have is
    // the zoomPoint, but it might be null. Here we grab the x and y
    // coordinates, or use defaults...
    double screenX = -1.0;
    double screenY = -1.0;
    if (this.zoomPoint != null) {
        screenX = this.zoomPoint.getX();
        screenY = this.zoomPoint.getY();
    }

    if (command.equals(PROPERTIES_COMMAND)) {
        doEditChartProperties();
    } else if (command.equals(SAVE_COMMAND)) {
        try {
            doSaveAs();
        } catch (IOException e) {
            logger.error("IOException:", e);
        }
    } else if (command.equals(PRINT_COMMAND)) {
        createChartPrintJob();
    } else if (command.equals(ZOOM_IN_BOTH_COMMAND)) {
        zoomInBoth(screenX, screenY);
    } else if (command.equals(ZOOM_IN_DOMAIN_COMMAND)) {
        zoomInDomain(screenX, screenY);
    } else if (command.equals(ZOOM_IN_RANGE_COMMAND)) {
        zoomInRange(screenX, screenY);
    } else if (command.equals(ZOOM_OUT_BOTH_COMMAND)) {
        zoomOutBoth(screenX, screenY);
    } else if (command.equals(ZOOM_OUT_DOMAIN_COMMAND)) {
        zoomOutDomain(screenX, screenY);
    } else if (command.equals(ZOOM_OUT_RANGE_COMMAND)) {
        zoomOutRange(screenX, screenY);
    } else if (command.equals(ZOOM_RESET_BOTH_COMMAND)) {
        restoreAutoBounds();
    } else if (command.equals(ZOOM_RESET_DOMAIN_COMMAND)) {
        restoreAutoDomainBounds();
    } else if (command.equals(ZOOM_RESET_RANGE_COMMAND)) {
        restoreAutoRangeBounds();
    }
}

From source file:ExText.java

/**
 * Handles menu selections.// w w w . j  a  v a 2  s.  com
 * 
 * @param event
 *            an ActionEvent indicating what menu action requires handling
 */
public void actionPerformed(ActionEvent event) {
    String arg = event.getActionCommand();
    if (arg.equals("Reset view"))
        reset();
    else if (arg.equals("Exit"))
        quit();
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Bearbeitet Menaktionen Project: SubmatixBTConfigPC Package: de.dmarcini.submatix.pclogger.gui
 * /*from w ww . j a  v  a 2  s.c  o  m*/
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 07.01.2012
 * @param ev
 *          Avtion event
 */
private void processMenuActions(ActionEvent ev) {
    String cmd = ev.getActionCommand();
    // /////////////////////////////////////////////////////////////////////////
    // Men EXIT Programm
    if (cmd.equals("exit")) {
        // Ordentlich verlassen ;-)
        tabbedPane.setSelectedIndex(programTabs.TAB_CONNECT.ordinal());
        exitProgram();
    }
    // /////////////////////////////////////////////////////////////////////////
    // Info Box anzeigen
    else if (cmd.equals("info")) {
        lg.debug("Call INFO-Dialog...");
        showInfoDialog();
    }
    // /////////////////////////////////////////////////////////////////////////
    // Hilfe Box anzeigen
    else if (cmd.equals("help")) {
        lg.debug("Call HELP-Dialog...");
        showHelpForm();
    }
    // /////////////////////////////////////////////////////////////////////////
    // Box fr diverse Einstellungen anzeigen
    else if (cmd.equals("set_propertys")) {
        showPropertysDialog();
    }
    // /////////////////////////////////////////////////////////////////////////
    // Sprachenmen wurde ausgewhlt
    else if (cmd.startsWith("lang_")) {
        // welche Sprache httens denn gern?
        lg.debug("Change Language...");
        String lang = cmd.replace("lang_", "");
        lg.info("change language to <" + lang + ">");
        changeProgramLanguage(lang);
    } else {
        lg.warn("unknown menu command <" + cmd + "> recived.");
    }
    return;
}