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:org.ash.gui.MainFrame.java

public void actionPerformed(ActionEvent e) {
    /** Get action command */
    String str = e.getActionCommand();

    /** Show settings window */
    if (str.equals(Options.getInstance().getResource("settingsMain.text"))) {
        settingsDialog.setModal(true);//from   w w  w .j a v a  2 s .  c  om
        settingsDialog.setVisible(true);
    }
    /** Show thumbnail detail panel*/
    if (str.equals(Options.getInstance().getResource("ThumbnailMain.text"))) {
        Thumbnail thumbnail = new Thumbnail(this, detailJPanel.getThumbnailDetailPanel());
        thumbnail.setModal(true);
        thumbnail.setVisible(true);
    }

}

From source file:com.headswilllol.basiclauncher.Launcher.java

public void actionPerformed(ActionEvent e) { // button was pressed
    if (e.getActionCommand().equals("play")) { // play button was pressed
        // clear dem buttons
        this.remove(play);
        this.remove(force);
        this.remove(noUpdate);
        this.remove(quit);
        File dir = new File(appData(), FOLDER_NAME + File.separator + "resources");
        if (!downloadDir.isEmpty()) // -d flag was used
            dir = new File(downloadDir, FOLDER_NAME + File.separator + "resources");
        dir.mkdir();//from w ww  .j  av a 2 s.  c o  m
        try {
            progress = "Downloading JSON file list...";
            paintImmediately(0, 0, width, height);
            Downloader jsonDl = new Downloader(new URL(JSON_LOCATION),
                    dir.getPath() + File.separator + "resources.json", "JSON file list", true);
            Thread jsonT = new Thread(jsonDl); // download in a separate thread so the GUI will continue to update
            jsonT.start();
            while (jsonT.isAlive()) {
            } // no need for a progress bar; it's tiny
            JSONArray files = (JSONArray) ((JSONObject) new JSONParser().parse(new InputStreamReader(
                    new File(dir.getPath(), "resources.json").toURI().toURL().openStream()))).get("resources");
            List<String> paths = new ArrayList<String>();
            for (Object obj : files) { // iterate the entries in the JSON file
                JSONObject jFile = (JSONObject) obj;
                String launch = ((String) jFile.get("launch")); // if true, resource will be used as main binary
                if (launch != null && launch.equals("true"))
                    main = new File(dir, ((String) jFile.get("localPath")).replace("/", File.separator));
                paths.add(((String) jFile.get("localPath")).replace("/", File.separator));
                File file = new File(dir, ((String) jFile.get("localPath")).replace("/", File.separator));
                boolean reacquire = false;
                if (!file.exists() || // files doesn't exist
                        (allowReacquire && // allow files to be reacquired
                                (update || // update forced
                                // mismatch between local and remote file
                                        !jFile.get("md5").equals(md5(file.getPath()))))) {
                    reacquire = true;
                    if (update)
                        System.out.println(
                                "Update forced, so file " + jFile.get("localPath") + " must be updated");
                    else if (!file.exists())
                        System.out.println("Cannot find local copy of file " + jFile.get("localPath"));
                    else
                        System.out.println("MD5 checksum for file " + jFile.get("localPath")
                                + " does not match expected value");
                    System.out.println("Attempting to reacquire...");
                    file.delete();
                    file.getParentFile().mkdirs();
                    file.createNewFile();
                    progress = "Downloading " + jFile.get("id"); // update the GUI
                    paintImmediately(0, 0, width, height);
                    Downloader dl = new Downloader(new URL((String) jFile.get("location")),
                            dir + File.separator
                                    + ((String) jFile.get("localPath")).replace("/", File.separator),
                            (String) jFile.get("id"), !jFile.containsKey("doNotSpoofUserAgent")
                                    || !Boolean.parseBoolean((String) jFile.get("doNotSpoofUserAgent")));
                    Thread th = new Thread(dl);
                    th.start();
                    eSize = getFileSize(new URL((String) jFile.get("location"))) / 8; // expected file size
                    speed = 0; // stores the current download speed
                    lastSize = 0; // stores the size of the downloaded file the last time the GUI was updated
                    while (th.isAlive()) { // wait but don't hang the main thread
                        aSize = file.length() / 8;
                        if (lastTime != -1) {
                            // wait so the GUI isn't constantly updating
                            if (System.currentTimeMillis() - lastTime >= SPEED_UPDATE_INTERVAL) {
                                speed = (aSize - lastSize) / ((System.currentTimeMillis() - lastTime) / 1000)
                                        * 8; // calculate new speed
                                lastTime = System.currentTimeMillis();
                                lastSize = aSize; // update the downloaded file's size
                            }
                        } else {
                            speed = 0; // reset the download speed
                            lastTime = System.currentTimeMillis(); // and the last time
                        }
                        paintImmediately(0, 0, width, height);
                    }
                    eSize = -1;
                    aSize = -1;
                }
                if (jFile.containsKey("extract")) { // file should be unzipped
                    HashMap<String, JSONObject> elements = new HashMap<String, JSONObject>();
                    for (Object ex : (JSONArray) jFile.get("extract")) {
                        elements.put((String) ((JSONObject) ex).get("path"), (JSONObject) ex);
                        paths.add(((String) ((JSONObject) ex).get("localPath")).replace("/", File.separator));
                        File f = new File(dir,
                                ((String) ((JSONObject) ex).get("localPath")).replace("/", File.separator));
                        if (!f.exists() || // file doesn't exist
                        // file isn't directory and has checksum
                                (!f.isDirectory() && ((JSONObject) ex).get("md5") != null &&
                                // mismatch between local and remote file
                                        !md5(f.getPath()).equals((((JSONObject) ex).get("md5")))))

                            reacquire = true;
                        if (((JSONObject) ex).get("id").equals("natives")) // specific to LWJGL launching
                            natives = new File(dir,
                                    ((String) ((JSONObject) ex).get("localPath")).replace("/", File.separator));
                    }
                    if (reacquire) {
                        try {
                            ZipFile zip = new ZipFile(new File(dir,
                                    ((String) jFile.get("localPath")).replace("/", File.separator)));
                            @SuppressWarnings("rawtypes")
                            Enumeration en = zip.entries();
                            List<String> dirs = new ArrayList<String>();
                            while (en.hasMoreElements()) { // iterate entries in ZIP file
                                ZipEntry entry = (ZipEntry) en.nextElement();
                                boolean extract = false; // whether the entry should be extracted
                                String parentDir = "";
                                if (elements.containsKey(entry.getName())) // entry is in list of files to extract
                                    extract = true;
                                else
                                    for (String d : dirs)
                                        if (entry.getName().contains(d)) {
                                            extract = true;
                                            parentDir = d;
                                        }
                                if (extract) {
                                    progress = "Extracting " + (elements.containsKey(entry.getName())
                                            ? elements.get(entry.getName()).get("id")
                                            : entry.getName()
                                                    .substring(entry.getName().indexOf(parentDir),
                                                            entry.getName().length())
                                                    .replace("/", File.separator)); // update the GUI
                                    paintImmediately(0, 0, width, height);
                                    if (entry.isDirectory()) {
                                        if (parentDir.equals(""))
                                            dirs.add((String) elements.get(entry.getName()).get("localPath"));
                                    } else {
                                        File path = new File(dir, (parentDir.equals(""))
                                                ? ((String) elements.get(entry.getName()).get("localPath"))
                                                        .replace("/", File.separator)
                                                : entry.getName()
                                                        .substring(entry.getName().indexOf(parentDir),
                                                                entry.getName().length())
                                                        .replace("/", File.separator)); // path to extract to
                                        if (path.exists())
                                            path.delete();
                                        unzip(zip, entry, path); // *zziiiip*
                                    }
                                }
                            }
                        } catch (Exception ex) {
                            ex.printStackTrace();
                            createExceptionLog(ex);
                            progress = "Failed to extract files from " + jFile.get("id");
                            fail = "Errors occurred; see log file for details";
                            launcher.paintImmediately(0, 0, width, height);
                        }
                    }
                }
            }

            checkFile(dir, dir, paths);
        } catch (Exception ex) { // can't open resource list
            ex.printStackTrace();
            createExceptionLog(ex);
            progress = "Failed to read JSON file list";
            fail = "Errors occurred; see log file for details";
            launcher.paintImmediately(0, 0, width, height);
        }

        launch();
    } else if (e.getActionCommand().equals("force")) {
        force.setActionCommand("noForce");
        force.setText("Will Force!");
        update = true;
        // reset do not reacquire button
        noUpdate.setActionCommand("noReacquire");
        noUpdate.setText("Do Not Reacquire");
        allowReacquire = true;
    } else if (e.getActionCommand().equals("noForce")) {
        force.setActionCommand("force");
        force.setText("Force Update");
        update = false;
    } else if (e.getActionCommand().equals("noReacquire")) {
        noUpdate.setActionCommand("yesReacquire");
        noUpdate.setText("Will Not Reacquire!");
        allowReacquire = false;
        // reset force update button
        force.setActionCommand("force");
        force.setText("Force Update");
        update = false;
    } else if (e.getActionCommand().equals("yesReacquire")) {
        noUpdate.setActionCommand("noReacquire");
        noUpdate.setText("Do Not Reacquire");
        allowReacquire = true;
    } else if (e.getActionCommand().equals("quit")) {
        pullThePlug();
    } else if (e.getActionCommand().equals("kill"))
        gameProcess.destroyForcibly();
}

From source file:net.sf.jabref.importer.OpenDatabaseAction.java

@Override
public void actionPerformed(ActionEvent e) {
    List<File> filesToOpen = new ArrayList<>();

    if (showDialog) {
        List<String> chosenStrings = FileDialogs.getMultipleFiles(frame,
                new File(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)),
                Collections.singletonList(".bib"), true);
        for (String chosen : chosenStrings) {
            if (chosen != null) {
                filesToOpen.add(new File(chosen));
            }/*w  w w. ja  va  2  s.c o  m*/
        }
    } else {
        LOGGER.info(Action.NAME + " " + e.getActionCommand());
        filesToOpen.add(new File(StringUtil.getCorrectFileName(e.getActionCommand(), "bib")));
    }

    openFiles(filesToOpen, true);
}

From source file:apidemo.PanScrollZoomDemo.java

/**
 * Handles an action event.//  w ww.j a v  a2  s.  c  o  m
 * 
 * @param evt
 *            the event.
 */
public void actionPerformed(final ActionEvent evt) {
    try {
        final String acmd = evt.getActionCommand();

        if (acmd.equals(ACTION_CMD_ZOOM_BOX)) {
            setPanMode(false);
        } else if (acmd.equals(ACTION_CMD_PAN)) {
            setPanMode(true);
        } else if (acmd.equals(ACTION_CMD_ZOOM_IN)) {
            final ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
            final Rectangle2D rect = info.getPlotInfo().getDataArea();
            zoomBoth(rect.getCenterX(), rect.getCenterY(), ZOOM_FACTOR);
        } else if (acmd.equals(ACTION_CMD_ZOOM_OUT)) {
            final ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
            final Rectangle2D rect = info.getPlotInfo().getDataArea();
            zoomBoth(rect.getCenterX(), rect.getCenterY(), 1 / ZOOM_FACTOR);
        } else if (acmd.equals(ACTION_CMD_ZOOM_TO_FIT)) {

            // X-axis (has no fixed borders)
            //            this.chartPanel.autoRangeHorizontal();

            // Y-Axes) (autoRangeVertical
            // not useful because of fixed borders
            final Plot plot = this.chartPanel.getChart().getPlot();
            if (plot instanceof ValueAxisPlot) {

                final XYPlot vvPlot = (XYPlot) plot;
                ValueAxis axis = vvPlot.getRangeAxis();
                if (axis != null) {
                    axis.setLowerBound(this.primYMinMax[0]);
                    axis.setUpperBound(this.primYMinMax[1]);
                }
                if (plot instanceof XYPlot) {
                    final XYPlot xyPlot = (XYPlot) plot;
                    axis = xyPlot.getRangeAxis(1);
                    if (axis != null) {
                        axis.setLowerBound(this.secondYMinMax[0]);
                        axis.setUpperBound(this.secondYMinMax[1]);
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:CustomAlphaTest.java

public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand().equals("Update") != false) {
        updateAlpha();/*from   w w  w.j  av a2  s .c  o  m*/
        updateUi();

        drawGraph();
        repaint();
    }
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd == "Salvar") {
        salvaAlteracoes.salvar();//from ww  w .j  ava 2s  . c  om

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

        int selectedStart = 0;
        int selectedEnd = 0;
        int corretordePosicoesdoLabel = 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++;
        }

        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)) {

            }
            /*
             * 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();

        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 = textAreaSourceCode.getTextPane().getText().replace("\r", "");
        int i;
        for (i = 0; i < (linha - 1); i++) {
            posAtual = codHTML.indexOf("\n", posAtual + 1);
        }
        i = 0;
        // Adaptao 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();
    }
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopSearchField.java

public DesktopSearchField() {
    composition = new JPanel();
    composition.setLayout(new BorderLayout());
    composition.setFocusable(false);// w  w w.  ja  v  a  2 s. co m

    comboBox = new SearchComboBox() {
        @Override
        public void setPopupVisible(boolean v) {
            if (!items.isEmpty()) {
                super.setPopupVisible(v);
            } else if (!v) {
                super.setPopupVisible(false);
            }
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (SearchAutoCompleteSupport.SEARCH_ENTER_COMMAND.equals(e.getActionCommand())) {
                enterHandling = true;
            }

            super.actionPerformed(e);
        }
    };
    comboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (settingValue || disableActionListener)
                return;

            if ("comboBoxEdited".equals(e.getActionCommand())) {
                Object selectedItem = comboBox.getSelectedItem();

                if (popupItemSelectionHandling) {
                    if (selectedItem instanceof ValueWrapper) {
                        Object selectedValue = ((ValueWrapper) selectedItem).getValue();
                        setValue(selectedValue);
                        updateOptionsDsItem();
                    } else if (selectedItem instanceof String) {
                        handleSearch((String) selectedItem);
                    }
                    popupItemSelectionHandling = false;
                } else if (enterHandling) {
                    if (selectedItem instanceof String) {
                        boolean found = false;
                        String newFilter = (String) selectedItem;
                        if (prevValue != null) {
                            if (Objects.equals(getDisplayString((Entity) prevValue), newFilter)) {
                                found = true;
                            }
                        }
                        if (!found) {
                            handleSearch(newFilter);
                        } else {
                            updateComponent(prevValue);
                            clearSearchVariants();
                        }
                    } else {
                        // Disable variants after select
                        clearSearchVariants();
                    }
                    enterHandling = false;
                }
            }

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    updateEditState();
                }
            });
        }
    });

    Component editorComponent = comboBox.getEditor().getEditorComponent();
    editorComponent.addKeyListener(new KeyAdapter() {
        @Override
        public void keyTyped(KeyEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    updateEditState();
                }
            });
        }
    });

    comboBox.setEditable(true);
    comboBox.setPrototypeDisplayValue("AAAAAAAAAAAA");
    autoComplete = SearchAutoCompleteSupport.install(comboBox, items);
    autoComplete.setFilterEnabled(false);

    for (int i = 0; i < comboBox.getComponentCount(); i++) {
        java.awt.Component component = comboBox.getComponent(i);
        component.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                clearSearchVariants();
                // Reset invalid value

                checkSelectedValue();
            }
        });
    }
    // set value only on PopupMenu closing to avoid firing listeners on keyboard navigation
    comboBox.addPopupMenuListener(new PopupMenuListener() {
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            comboBox.updatePopupWidth();
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            if (!autoComplete.isEditableState()) {
                // Only if realy item changed
                if (!enterHandling) {
                    Object selectedItem = comboBox.getSelectedItem();
                    if (selectedItem instanceof ValueWrapper) {
                        Object selectedValue = ((ValueWrapper) selectedItem).getValue();
                        setValue(selectedValue);
                        updateOptionsDsItem();
                    } else if (selectedItem instanceof String) {
                        handleSearch((String) selectedItem);
                    }
                } else {
                    popupItemSelectionHandling = true;
                }

                updateMissingValueState();
            }
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
            clearSearchVariants();
        }
    });

    setFilterMode(DEFAULT_FILTER_MODE);

    textField = new JTextField();
    textField.setEditable(false);
    UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
    valueFormatter = new DefaultValueFormatter(sessionSource.getLocale());

    composition.add(comboBox, BorderLayout.CENTER);
    impl = comboBox;

    DesktopComponentsHelper.adjustSize(comboBox);
}

From source file:edu.harvard.i2b2.query.QueryConceptTreePanel.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("Constrain Item ...")) {
        //JOptionPane.showMessageDialog(this, "Constrain Item ...");
        //DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent();
        //QueryConceptTreeNodeData ndata = (QueryConceptTreeNodeData) node.getUserObject();
        //final QueryConstrainFrame cframe = new QueryConstrainFrame(ndata);
        //cframe.setTitle("Constrain Item: "+ndata.name());
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                //cframe.setVisible(true);
            }//from ww  w  . j a va 2s . com
        });
    } else if (e.getActionCommand().equalsIgnoreCase("Delete Item")) {
        //JOptionPane.showMessageDialog(this, "Delete Item");
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent();
        treeModel.removeNodeFromParent(node);
        data().getItems().remove(node.getUserObject());
    }
}

From source file:iad_zad3.gui.MainWindow.java

private void jButtonChooseKohonenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonChooseKohonenActionPerformed
    try {/*  w ww  .j  a va2  s . co  m*/
        gatherParameters(evt.getActionCommand());
        clusteringAlgorithm = new KohonenClustering(new EuclidianDistance(), helper.getData(),
                Integer.parseInt(jTextCentroids.getText()), Integer.parseInt(jTextIterations.getText()),
                helper.getSOMParameters(), ((jComboBox1.getSelectedIndex()) != 1));
        jProgressBar1.setMaximum(Integer.parseInt(jTextIterations.getText()));
        jLabelAlgorithm.setText("Kohonena");
        switchRunButtons(true);
    } catch (NoFileException ex) {
        switchChoiceButtons(false);
        switchRunButtons(false);
    } catch (GUIHelper.NoParamsException ex) {
        switchRunButtons(false);
        Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:iad_zad3.gui.MainWindow.java

private void jButtonChooseNeuralGasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonChooseNeuralGasActionPerformed
    try {/*from w  w  w  .  j  a  v a 2 s .com*/
        gatherParameters(evt.getActionCommand());
        clusteringAlgorithm = new NeuralGasClustering(new EuclidianDistance(), helper.getData(),
                Integer.parseInt(jTextCentroids.getText()), Integer.parseInt(jTextIterations.getText()),
                helper.getSOMParameters());
        jProgressBar1.setMaximum(Integer.parseInt(jTextIterations.getText()));
        jLabelAlgorithm.setText("gazu neuronowego");
        switchRunButtons(true);
    } catch (NoFileException ex) {
        switchChoiceButtons(false);
        switchRunButtons(false);
    } catch (GUIHelper.NoParamsException ex) {
        switchRunButtons(false);
        Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
    }
}