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.preenchedor_formulario.PanelPreenchedorFormulario.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Salvar") {
        salvaAlteracoes.salvar();/*from w  w w . jav a2  s . com*/
        /*
         * if (arquivo == null) { salvarComo(); // avalia(); return; }
         * arquivo.write(boxCode.getText());//
         */
        avalia();
    } else if (cmd == "Aplicar") {

        if (controle != null) {

            int pos = controle.getIniIndex(erroAtual);
            String newCod = controle.corrige(texto.getText(), erroAtual);
            textAreaSourceCode.setText(newCod);
            salvaAlteracoes.setAlterado();
            TxtBuffer.setContent(textAreaSourceCode.getText());
            reavalia(newCod);
            codigo = textAreaSourceCode.getText();
            controle.avalia(codigo, true);
            textAreaSourceCode.getTextPane().setCaretPosition(pos);
            controle.avalia(this, codigo, 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 == "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 (panelOriginal != null) {
            panelOriginal.textAreaSourceCode.getTextPane().selectAll();
        }
    } else if (cmd == "Cancelar") {
        salvaAlteracoes.cancelar();
    }
}

From source file:org.peerfact.impl.service.aggregation.skyeye.visualization.SkyNetVisualization.java

@Override
public void actionPerformed(ActionEvent arg0) {
    String name = arg0.getActionCommand();
    if (arg0.getSource() instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem j = (JCheckBoxMenuItem) arg0.getSource();
        if (j.isSelected()) {
            createPlotInWindow(name);//from ww w  .  java 2  s . c  o m
        } else {
            deletePlotInWindow(name);
        }
    } else {
        if (name.contains("Average Metrics")) {
            if (name.startsWith("Display")) {
                displayAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(0));
            } else {
                removeAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(0));
            }
        } else if (name.contains("General Metrics")) {
            if (name.startsWith("Display")) {
                displayAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(1));
            } else {
                removeAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(1));
            }
        } else if (name.contains("Metrics for Receiving")) {
            if (name.startsWith("Display")) {
                displayAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(2));
            } else {
                removeAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(2));
            }
        } else if (name.contains("Metrics for Sending")) {
            if (name.startsWith("Display")) {
                displayAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(3));
            } else {
                removeAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(3));
            }
        } else {
            for (int i = 0; i < mb.getMenu(1).getMenuComponentCount(); i++) {
                if (mb.getMenu(1).getMenuComponent(i) instanceof JMenu) {
                    if (name.startsWith("Display")) {
                        displayAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(i));
                    } else {
                        removeAllMetricsOfAGroup((JMenu) mb.getMenu(1).getMenuComponent(i));
                    }
                }
            }
        }
    }
    validate();
    repaint();
    // Runtime.getRuntime().gc();
}

From source file:Human1.java

public void actionPerformed(ActionEvent e) {
    String action = e.getActionCommand();
    Object source = e.getSource();
    if (action == snapImageString) {
        Point loc = canvas.getLocationOnScreen();
        offScreenCanvas.setOffScreenLocation(loc);
        Dimension dim = canvas.getSize();
        dim.width *= offScreenScale;//from w  ww.  jav a  2 s . c o m
        dim.height *= offScreenScale;
        nf.setMinimumIntegerDigits(3);
        offScreenCanvas.snapImageFile(outFileBase + nf.format(outFileSeq++), dim.width, dim.height);
        nf.setMinimumIntegerDigits(0);
    }
}

From source file:WizardDialog.java

/**
 * Handles events./*w ww  .  ja  v a  2 s  .com*/
 * 
 * @param event
 *          the event.
 */
public void actionPerformed(final ActionEvent event) {
    final String command = event.getActionCommand();
    if (command.equals("nextButton")) {
        next();
    } else if (command.equals("previousButton")) {
        previous();
    } else if (command.equals("finishButton")) {
        finish();
    }
}

From source file:be.fedict.eid.tsl.tool.TslTool.java

@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (EXIT_ACTION_COMMAND.equals(command)) {
        System.exit(0);/*from  ww  w . ja  va  2  s. co  m*/
    } else if (OPEN_ACTION_COMMAND.equals(command)) {
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("Open TSL");
        int returnValue = fileChooser.showOpenDialog(this);
        if (returnValue == JFileChooser.APPROVE_OPTION) {
            displayTsl(fileChooser.getSelectedFile());
        }
    } else if (ABOUT_ACTION_COMMAND.equals(command)) {
        JOptionPane.showMessageDialog(this,
                "eID TSL Tool\n" + "Copyright (C) 2009-2013 FedICT\n" + "http://code.google.com/p/eid-tsl/",
                "About", JOptionPane.INFORMATION_MESSAGE);
    } else if (CLOSE_ACTION_COMMAND.equals(command)) {
        if (this.activeTslInternalFrame.getTrustServiceList().hasChanged()) {
            int result = JOptionPane.showConfirmDialog(this, "TSL has been changed.\n" + "Save the TSL?",
                    "Save", JOptionPane.YES_NO_CANCEL_OPTION);
            if (JOptionPane.CANCEL_OPTION == result) {
                return;
            }
            if (JOptionPane.YES_OPTION == result) {
                try {
                    this.activeTslInternalFrame.save();
                } catch (IOException e) {
                    LOG.error("IO error: " + e.getMessage(), e);
                }
            }
        }
        try {
            this.activeTslInternalFrame.setClosed(true);
        } catch (PropertyVetoException e) {
            LOG.warn("property veto error: " + e.getMessage(), e);
        }
    } else if (SIGN_ACTION_COMMAND.equals(command)) {
        LOG.debug("sign");
        TrustServiceList trustServiceList = this.activeTslInternalFrame.getTrustServiceList();
        if (trustServiceList.hasSignature()) {
            int confirmResult = JOptionPane.showConfirmDialog(this,
                    "TSL is already signed.\n" + "Resign the TSL?", "Resign", JOptionPane.OK_CANCEL_OPTION);
            if (JOptionPane.CANCEL_OPTION == confirmResult) {
                return;
            }
        }
        SignSelectPkcs11FinishablePanel pkcs11Panel = new SignSelectPkcs11FinishablePanel();
        WizardDescriptor wizardDescriptor = new WizardDescriptor(
                new WizardDescriptor.Panel[] { new SignInitFinishablePanel(), pkcs11Panel,
                        new SignSelectCertificatePanel(pkcs11Panel, trustServiceList),
                        new SignFinishFinishablePanel() });
        wizardDescriptor.setTitle("Sign TSL");
        wizardDescriptor.putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
        DialogDisplayer dialogDisplayer = DialogDisplayer.getDefault();
        Dialog wizardDialog = dialogDisplayer.createDialog(wizardDescriptor);
        wizardDialog.setVisible(true);
    } else if (SAVE_ACTION_COMMAND.equals(command)) {
        LOG.debug("save");
        try {
            this.activeTslInternalFrame.save();
            this.saveMenuItem.setEnabled(false);
        } catch (IOException e) {
            LOG.debug("IO error: " + e.getMessage(), e);
        }
    } else if (SAVE_AS_ACTION_COMMAND.equals(command)) {
        LOG.debug("save as");
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("Save As");
        int result = fileChooser.showSaveDialog(this);
        if (JFileChooser.APPROVE_OPTION == result) {
            File tslFile = fileChooser.getSelectedFile();
            if (tslFile.exists()) {
                int confirmResult = JOptionPane.showConfirmDialog(this,
                        "File already exists.\n" + tslFile.getAbsolutePath() + "\n" + "Overwrite file?",
                        "Overwrite", JOptionPane.OK_CANCEL_OPTION);
                if (JOptionPane.CANCEL_OPTION == confirmResult) {
                    return;
                }
            }
            try {
                this.activeTslInternalFrame.saveAs(tslFile);
            } catch (IOException e) {
                LOG.debug("IO error: " + e.getMessage(), e);
            }
            this.saveMenuItem.setEnabled(false);
        }
    } else if (EXPORT_ACTION_COMMAND.equals(command)) {
        LOG.debug("export");
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setDialogTitle("Export to PDF");
        int result = fileChooser.showSaveDialog(this);
        if (JFileChooser.APPROVE_OPTION == result) {
            File pdfFile = fileChooser.getSelectedFile();
            if (pdfFile.exists()) {
                int confirmResult = JOptionPane.showConfirmDialog(this,
                        "File already exists.\n" + pdfFile.getAbsolutePath() + "\n" + "Overwrite file?",
                        "Overwrite", JOptionPane.OK_CANCEL_OPTION);
                if (JOptionPane.CANCEL_OPTION == confirmResult) {
                    return;
                }
            }
            try {
                this.activeTslInternalFrame.export(pdfFile);
            } catch (IOException e) {
                LOG.debug("IO error: " + e.getMessage(), e);
            }
        }
    } else if ("TSL-BE-2010-T1".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2010, Trimester.FIRST);
        displayTsl("*TSL-BE-2010-T1.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2010-T2".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2010, Trimester.SECOND);
        displayTsl("*TSL-BE-2010-T2.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2010-T3".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2010, Trimester.THIRD);
        displayTsl("*TSL-BE-2010-T3.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2011-T1".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2011, Trimester.FIRST);
        displayTsl("*TSL-BE-2011-T1.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2011-T2".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2011, Trimester.SECOND);
        displayTsl("*TSL-BE-2011-T2.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2011-T3".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2011, Trimester.THIRD);
        displayTsl("*TSL-BE-2011-T3.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2012-T1".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2012, Trimester.FIRST);
        displayTsl("*TSL-BE-2012-T1.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2012-T2".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2012, Trimester.SECOND);
        displayTsl("*TSL-BE-2012-T2.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2012-T3".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2012, Trimester.THIRD);
        displayTsl("*TSL-BE-2012-T3.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2013-T1".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2013, Trimester.FIRST);
        displayTsl("*TSL-BE-2013-T1.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2013-T2".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2013, Trimester.SECOND);
        displayTsl("*TSL-BE-2013-T2.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2013-T3".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2013, Trimester.THIRD);
        displayTsl("*TSL-BE-2013-T3.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2014-T1".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2014, Trimester.FIRST);
        displayTsl("*TSL-BE-2014-T1.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2014-T2".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2014, Trimester.SECOND);
        displayTsl("*TSL-BE-2014-T2.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2014-T3".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2014, Trimester.THIRD);
        displayTsl("*TSL-BE-2014-T3.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2015-T1".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2015, Trimester.FIRST);
        displayTsl("*TSL-BE-2015-T1.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2015-T2".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2015, Trimester.SECOND);
        displayTsl("*TSL-BE-2015-T2.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    } else if ("TSL-BE-2015-T3".equals(command)) {
        TrustServiceList trustServiceList = BelgianTrustServiceListFactory.newInstance(2015, Trimester.THIRD);
        displayTsl("*TSL-BE-2015-T3.xml", trustServiceList);
        this.saveMenuItem.setEnabled(false);
    }
}

From source file:canreg.client.gui.components.FastFilterInternalFrame.java

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase(DictionaryElementChooser.OK_ACTION)) {
        dictionaryElementChooserAssignedTextField
                .setText(dictionaryElementChooser.getSelectedElement().getCode());
    }//w  ww  . j  av  a2 s  . co m
}

From source file:com.funambol.admin.settings.panels.EditDailyRollingFileAppender.java

/**
 * Create the panel//from  ww w  . j  av a2s.  co  m
 * @throws Exception if error occures during creation of the panel.
 */
private void init() throws Exception {

    final int h = 18;
    final int x1 = 15;
    final int x2 = 150;
    final int w1 = 100;
    final int w2 = 310;

    int y = 40;
    int dy = 25;

    setLayout(null);
    setName(Bundle.getMessage(Bundle.EDIT_DAILY_ROLLING_FILE_APPENDER_PANEL_NAME));

    panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_DAILY_ROLLING_FILE_APPENDER_PANEL_NAME));
    panelNameLabel.setBounds(new Rectangle(14, 5, 290, 28));
    panelNameLabel.setAlignmentX(SwingConstants.CENTER);
    panelNameLabel.setBorder(new TitledBorder(""));

    nameLabel.setText(Bundle.getMessage(Bundle.LABEL_APPENDER_NAME) + " :");
    nameLabel.setBounds(new Rectangle(x1, y, w1, h));
    nameLabel2.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;

    fileNameLabel.setText(Bundle.getMessage(Bundle.LABEL_FILE_NAME) + " :");
    fileNameLabel.setBounds(new Rectangle(x1, y, w1, h));
    fileNameValue.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;

    datePatternLabel.setText(Bundle.getMessage(Bundle.LABEL_DATE_PATTERN) + " :");
    datePatternLabel.setBounds(new Rectangle(x1, y, w1, h));
    datePatternValue.setBounds(new Rectangle(x2, y, w2, h));
    datePatternValue.setHorizontalAlignment(JTextField.RIGHT);

    y += dy;

    conversionPatternLabel.setText(Bundle.getMessage(Bundle.LABEL_PATTERN_LAYOUT) + " :");
    conversionPatternLabel.setBounds(new Rectangle(x1, y, w1, h));
    conversionPattern.setBounds(new Rectangle(x2, y, w2, h));

    y += dy;

    noteLabel.setText(Bundle.getMessage(Bundle.LABEL_FILE_APPENDER_NOTE));
    noteLabel.setBounds(new Rectangle(x1, y, 500, h));

    y += dy;
    y += dy;

    confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_SAVE));
    confirmButton.setBounds(new Rectangle(401, y, 60, 25));

    confirmButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                validateValues();
                getValues();
                EditDailyRollingFileAppender.this.actionPerformed(new ActionEvent(
                        EditDailyRollingFileAppender.this, ACTION_EVENT_UPDATE, event.getActionCommand()));
            } catch (Exception e) {
                notifyError(new AdminException(e.getMessage()));
            }
        }
    });

    add(panelNameLabel, null);
    add(nameLabel, null);
    add(nameLabel2, null);
    add(fileNameLabel, null);
    add(fileNameValue, null);
    add(datePatternLabel, null);
    add(datePatternValue, null);
    add(conversionPatternLabel, null);
    add(conversionPattern, null);
    add(noteLabel, null);
    add(confirmButton, null);

    GuiFactory.setDefaultFont(this);
    panelNameLabel.setFont(GuiFactory.titlePanelFont);
}

From source file:com.game.ui.views.ItemPanel.java

@Override
public void actionPerformed(ActionEvent ae) {
    validationMess.setText("");
    validationMess.setVisible(false);//from   w w w.j a v  a 2 s .co m
    if (ae.getActionCommand().equalsIgnoreCase("dropDown")) {
        JPanel panel = (JPanel) comboBox.getParent().getComponent(4);
        String name = comboBox.getSelectedItem().toString();
        if (ringPanel) {
            getRingDetailForName(name, panel);
        } else if (armourPanel) {
            getArmourDetailForName(name, panel);
        } else if (potionPanel) {
            getPotionDetailForName(name, panel);
        } else if (treasurePanel) {
            getTreasureDetailForName(name, panel);
        }
    } else {
        JButton btn = (JButton) ae.getSource();
        JPanel panel = (JPanel) btn.getParent();
        String name = ((JTextField) panel.getComponent(2)).getText();
        if (ringPanel) {
            persistRingData(name, panel);
        } else if (armourPanel) {
            persistArmourData(name, panel);
        } else if (potionPanel) {
            persistPotionData(name, panel);
        } else if (treasurePanel) {
            persistTreasure(name, panel);
        }
    }
    this.revalidate();
}

From source file:net.sf.mzmine.modules.visualization.spectra.SpectraVisualizerWindow.java

public void actionPerformed(ActionEvent event) {

    String command = event.getActionCommand();

    if (command.equals("PEAKLIST_CHANGE")) {

        // If no scan is loaded yet, ignore
        if (currentScan == null)
            return;

        PeakList selectedPeakList = bottomPanel.getSelectedPeakList();
        loadPeaks(selectedPeakList);/*from  ww  w. j ava 2  s  .co  m*/

    }

    if (command.equals("PREVIOUS_SCAN")) {

        if (dataFile == null)
            return;

        int msLevel = currentScan.getMSLevel();
        int scanNumbers[] = dataFile.getScanNumbers(msLevel);
        int scanIndex = Arrays.binarySearch(scanNumbers, currentScan.getScanNumber());
        if (scanIndex > 0) {
            final int prevScanIndex = scanNumbers[scanIndex - 1];

            Runnable newThreadRunnable = new Runnable() {

                public void run() {
                    loadRawData(dataFile.getScan(prevScanIndex));
                }

            };

            Thread newThread = new Thread(newThreadRunnable);
            newThread.start();

        }
    }

    if (command.equals("NEXT_SCAN")) {

        if (dataFile == null)
            return;

        int msLevel = currentScan.getMSLevel();
        int scanNumbers[] = dataFile.getScanNumbers(msLevel);
        int scanIndex = Arrays.binarySearch(scanNumbers, currentScan.getScanNumber());

        if (scanIndex < (scanNumbers.length - 1)) {
            final int nextScanIndex = scanNumbers[scanIndex + 1];

            Runnable newThreadRunnable = new Runnable() {

                public void run() {
                    loadRawData(dataFile.getScan(nextScanIndex));
                }

            };

            Thread newThread = new Thread(newThreadRunnable);
            newThread.start();

        }
    }

    if (command.equals("SHOW_MSMS")) {

        String selectedScanString = (String) bottomPanel.getMSMSSelector().getSelectedItem();
        if (selectedScanString == null)
            return;

        int sharpIndex = selectedScanString.indexOf('#');
        int commaIndex = selectedScanString.indexOf(',');
        selectedScanString = selectedScanString.substring(sharpIndex + 1, commaIndex);
        int selectedScan = Integer.valueOf(selectedScanString);

        SpectraVisualizerModule.showNewSpectrumWindow(dataFile, selectedScan);
    }

    if (command.equals("TOGGLE_PLOT_MODE")) {
        if (spectrumPlot.getPlotMode() == PlotMode.CONTINUOUS) {
            spectrumPlot.setPlotMode(PlotMode.CENTROID);
            toolBar.setCentroidButton(false);
        } else {
            spectrumPlot.setPlotMode(PlotMode.CONTINUOUS);
            toolBar.setCentroidButton(true);
        }
    }

    if (command.equals("SHOW_DATA_POINTS")) {
        spectrumPlot.switchDataPointsVisible();
    }

    if (command.equals("SHOW_ANNOTATIONS")) {
        spectrumPlot.switchItemLabelsVisible();
    }

    if (command.equals("SHOW_PICKED_PEAKS")) {
        spectrumPlot.switchPickedPeaksVisible();
    }

    if (command.equals("SHOW_ISOTOPE_PEAKS")) {
        spectrumPlot.switchIsotopePeaksVisible();
    }

    if (command.equals("SETUP_AXES")) {
        AxesSetupDialog dialog = new AxesSetupDialog(spectrumPlot.getXYPlot());
        dialog.setVisible(true);
    }

    if (command.equals("ADD_ISOTOPE_PATTERN")) {

        IsotopePattern newPattern = IsotopePatternCalculator.showIsotopePredictionDialog();

        if (newPattern == null)
            return;

        loadIsotopes(newPattern);

    }

    if ((command.equals("ZOOM_IN")) || (command.equals("ZOOM_IN_BOTH_COMMAND"))) {
        spectrumPlot.getXYPlot().getDomainAxis().resizeRange(1 / zoomCoefficient);
    }

    if ((command.equals("ZOOM_OUT")) || (command.equals("ZOOM_OUT_BOTH_COMMAND"))) {
        spectrumPlot.getXYPlot().getDomainAxis().resizeRange(zoomCoefficient);
    }

    if (command.equals("SET_SAME_RANGE")) {

        // Get current axes range
        NumberAxis xAxis = (NumberAxis) spectrumPlot.getXYPlot().getDomainAxis();
        NumberAxis yAxis = (NumberAxis) spectrumPlot.getXYPlot().getRangeAxis();
        double xMin = (double) xAxis.getRange().getLowerBound();
        double xMax = (double) xAxis.getRange().getUpperBound();
        double xTick = (double) xAxis.getTickUnit().getSize();
        double yMin = (double) yAxis.getRange().getLowerBound();
        double yMax = (double) yAxis.getRange().getUpperBound();
        double yTick = (double) yAxis.getTickUnit().getSize();

        // Get all frames of my class
        Window spectraFrames[] = JFrame.getWindows();

        // Set the range of these frames
        for (Window frame : spectraFrames) {
            if (!(frame instanceof SpectraVisualizerWindow))
                continue;
            SpectraVisualizerWindow spectraFrame = (SpectraVisualizerWindow) frame;
            spectraFrame.setAxesRange(xMin, xMax, xTick, yMin, yMax, yTick);
        }

    }

}

From source file:com.funambol.exchange.admin.DefaultExchangeConnectorConfigPanel.java

/**
 * Create the panel//from w  ww  .  j  av a2 s.c o  m
 */
private void init() {

    JLabel title, contactFolderLabel, eventFolderLabel, taskFolderLabel, noteFolderLabel, seccServerLabel,
            seccPortLabel, exchangeServerLabel;
    JPanel seccPanel, exchangePanel, sslPanel;

    title = new JLabel();
    exchangePanel = new JPanel();
    seccPanel = new JPanel();
    sslPanel = new JPanel();

    contactFolderValue = new JTextField();
    eventFolderValue = new JTextField();
    taskFolderValue = new JTextField();
    noteFolderValue = new JTextField();
    seccServerLabel = new JLabel();
    seccServerValue = new JTextField();
    seccPortLabel = new JLabel();
    seccPortValue = new JTextField();
    useSSLValue = new JCheckBox();
    useFBAValue = new JCheckBox();
    useKeyStoreValue = new JCheckBox();
    keyStoreFileNameLabel = new JLabel();
    keyStoreFileNameValue = new JTextField();
    keyStorePasswordLabel = new JLabel();
    keyStorePasswordValue = new JTextField();

    exchangeServerLabel = new JLabel();
    exchangeServerValue = new JTextField();
    exchangeServerNameLabel = new JLabel();
    exchangeServerNameValue = new JTextField();
    setLayout(null);

    title.setFont(GuiFactory.titlePanelFont);
    title.setText("Funambol Exchange Connector");
    title.setBounds(new Rectangle(14, 5, 316, 28));
    title.setAlignmentX(SwingConstants.CENTER);
    title.setBorder(new TitledBorder(""));

    contactFolderLabel = new JLabel();
    contactFolderLabel.setText("Contact Folder: ");
    contactFolderLabel.setBounds(14, 35, 116, 15);
    add(contactFolderLabel);
    contactFolderValue.setBounds(150, 35, 220, 19);
    add(contactFolderValue);

    eventFolderLabel = new JLabel();
    eventFolderLabel.setText("Event Folder: ");
    eventFolderLabel.setBounds(14, 65, 116, 15);
    add(eventFolderLabel);
    eventFolderValue.setBounds(150, 65, 220, 19);
    add(eventFolderValue);

    taskFolderLabel = new JLabel();
    taskFolderLabel.setText("Task Folder: ");
    taskFolderLabel.setBounds(14, 95, 116, 15);
    add(taskFolderLabel);
    taskFolderValue.setBounds(150, 95, 220, 19);
    add(taskFolderValue);

    noteFolderLabel = new JLabel();
    noteFolderLabel.setText("Note Folder: ");
    noteFolderLabel.setBounds(14, 125, 116, 15);
    add(noteFolderLabel);
    noteFolderValue.setBounds(150, 125, 220, 19);
    add(noteFolderValue);

    seccPanel.setLayout(null);
    seccPanel.setBorder(new TitledBorder("HTTP Server Configuration"));

    seccServerLabel.setText("Server:");
    seccPanel.add(seccServerLabel);
    seccServerLabel.setBounds(10, 20, 116, 15);
    seccPanel.add(seccServerValue);
    seccServerValue.setBounds(150, 20, 220, 19);
    seccServerValue.setFont(GuiFactory.defaultFont);

    seccPortLabel.setText("Port:");
    seccPanel.add(seccPortLabel);
    seccPortLabel.setBounds(10, 50, 131, 15);
    seccPanel.add(seccPortValue);
    seccPortValue.setBounds(150, 50, 220, 19);
    seccPortValue.setFont(GuiFactory.defaultFont);

    add(seccPanel);
    seccPanel.setBounds(10, 155, 380, 80);

    exchangePanel.setLayout(null);
    exchangePanel.setBorder(new TitledBorder("WebDav Message Configuration"));

    exchangeServerLabel.setText("Server: ");
    exchangePanel.add(exchangeServerLabel);
    exchangeServerLabel.setBounds(10, 20, 150, 19);
    exchangePanel.add(exchangeServerValue);
    exchangeServerValue.setBounds(150, 20, 220, 19);
    exchangeServerValue.setFont(GuiFactory.defaultFont);

    exchangeServerNameLabel.setText("Name:");
    exchangeServerNameLabel.setBounds(10, 50, 150, 19);
    exchangePanel.add(exchangeServerNameLabel);
    exchangeServerNameValue.setBounds(150, 50, 220, 19);
    exchangeServerNameValue.setFont(GuiFactory.defaultFont);
    exchangePanel.add(exchangeServerNameValue);

    add(exchangePanel);
    exchangePanel.setBounds(10, 255, 380, 80);

    //the ssl option panel

    sslPanel.setLayout(null);
    sslPanel.setBorder(new TitledBorder("SSL"));

    useSSLValue.setText("Use SSL");
    useSSLValue.setSelected(false);
    useSSLValue.setBounds(5, 20, 150, 19);
    sslPanel.add(useSSLValue);

    useFBAValue.setText("Use Form-Based Authentication");
    useFBAValue.setSelected(true);
    useFBAValue.setBounds(5, 40, 250, 19);
    sslPanel.add(useFBAValue);

    useKeyStoreValue.setText("Use Keystore");
    useKeyStoreValue.setSelected(false);
    useKeyStoreValue.setBounds(5, 60, 200, 19);
    sslPanel.add(useKeyStoreValue);

    useKeyStoreValue.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent acEvent) {
            boolean enabled = useKeyStoreValue.isSelected();
            keyStoreFileNameLabel.setEnabled(enabled);
            keyStoreFileNameValue.setEnabled(enabled);
            keyStorePasswordLabel.setEnabled(enabled);
            keyStorePasswordValue.setEnabled(enabled);
        }
    });

    keyStoreFileNameLabel.setText("Key Store File: ");
    sslPanel.add(keyStoreFileNameLabel);
    keyStoreFileNameLabel.setEnabled(false);
    keyStoreFileNameLabel.setBounds(10, 80, 131, 15);
    sslPanel.add(keyStoreFileNameValue);
    keyStoreFileNameValue.setEnabled(false);
    keyStoreFileNameValue.setBounds(150, 80, 220, 19);
    keyStoreFileNameValue.setFont(GuiFactory.defaultFont);

    keyStorePasswordLabel.setText("Key Store Password: ");
    sslPanel.add(keyStorePasswordLabel);
    keyStorePasswordLabel.setEnabled(false);
    keyStorePasswordLabel.setBounds(10, 110, 131, 15);
    sslPanel.add(keyStorePasswordValue);
    keyStorePasswordValue.setEnabled(false);
    keyStorePasswordValue.setBounds(150, 110, 220, 19);
    keyStorePasswordValue.setFont(GuiFactory.defaultFont);

    add(sslPanel);
    sslPanel.setBounds(10, 355, 450, 140);

    confirmButton.setFont(GuiFactory.defaultFont);
    confirmButton.setText("Save");
    add(confirmButton);
    confirmButton.setBounds(120, 500, 70, 25);
    confirmButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            getValues();
            configPanel.saveDefaultConfig(event.getActionCommand());
            configPanel.finishedDefaultConfig();
        }
    });

    cancelButton.setFont(GuiFactory.defaultFont);
    cancelButton.setText("Cancel");
    add(cancelButton);
    cancelButton.setBounds(200, 500, 70, 25);
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            configPanel.finishedDefaultConfig();
        }

    });

    //
    // Setting font...
    //
    Component[] components = getComponents();
    for (int i = 0; (components != null) && (i < components.length); ++i) {
        components[i].setFont(GuiFactory.defaultFont);
    }

    //
    // We add it as the last one so that the font won't be changed
    //
    add(title);
}