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:edu.ku.brc.ui.tmanfe.SpreadSheet.java

public void actionPerformed(final ActionEvent e) {
    if (UIRegistry.getPermanentFocusOwner() != this) // bail
    {//from w w  w.  j ava 2 s  . c om
        return;
    }

    //
    // The code in this method was tken from a JavaWorld Example
    //
    final boolean isCut = e.getActionCommand().compareTo("Cut") == 0 || e.getActionCommand().equals("x");
    if (e.getActionCommand().compareTo("Copy") == 0 || e.getActionCommand().equals("c") || isCut) {
        SwingUtilities.invokeLater(new Runnable() {

            /* (non-Javadoc)
             * @see java.lang.Runnable#run()
             */
            @Override
            public void run() {
                cutOrCopy(isCut);
            }

        });
    } else if (e.getActionCommand().compareTo("Paste") == 0 || e.getActionCommand().equals("v")) {
        SwingUtilities.invokeLater(new Runnable() {

            /* (non-Javadoc)
             * @see java.lang.Runnable#run()
             */
            @Override
            public void run() {
                paste();
            }

        });
    }
}

From source file:javazoom.jlgui.player.amp.PlayerUI.java

/**
 * Process action event./*from ww  w  .  j ava  2 s  . com*/
 * @param e
 */
public void processActionEvent(ActionEvent e) {
    String cmd = e.getActionCommand();
    log.debug("Action=" + cmd + " (EDT=" + SwingUtilities.isEventDispatchThread() + ")");
    // Preferences.
    if (cmd.equalsIgnoreCase(PlayerActionEvent.MIPREFERENCES)) {
        processPreferences(e.getModifiers());
    }
    // Skin browser
    else if (cmd.equals(PlayerActionEvent.MISKINBROWSER)) {
        processSkinBrowser(e.getModifiers());
    }
    // Jump to file
    else if (cmd.equals(PlayerActionEvent.MIJUMPFILE)) {
        processJumpToFile(e.getModifiers());
    }
    // Stop
    else if (cmd.equals(PlayerActionEvent.MISTOP)) {
        processStop(MouseEvent.BUTTON1_MASK);
    }
    // Load skin
    else if (e.getActionCommand().equals(PlayerActionEvent.MILOADSKIN)) {
        File[] file = FileSelector.selectFile(loader, FileSelector.OPEN, false,
                ui.getResource("skin.extension"), ui.getResource("loadskin.dialog.filtername"),
                new File(config.getLastDir()));
        if (FileSelector.getInstance().getDirectory() != null)
            config.setLastDir(FileSelector.getInstance().getDirectory().getPath());
        if (file != null) {
            String fsFile = file[0].getName();
            ui.setPath(config.getLastDir() + fsFile);
            loadSkin();
            config.setDefaultSkin(ui.getPath());
        }
    }
    // Shuffle
    else if (cmd.equals(PlayerActionEvent.ACSHUFFLE)) {
        if (ui.getAcShuffle().isSelected()) {
            config.setShuffleEnabled(true);
            if (playlist != null) {
                playlist.shuffle();
                playlistUI.initPlayList();
                // Play from the top
                PlaylistItem pli = playlist.getCursor();
                setCurrentSong(pli);
            }
        } else {
            config.setShuffleEnabled(false);
        }
    }
    // Repeat
    else if (cmd.equals(PlayerActionEvent.ACREPEAT)) {
        if (ui.getAcRepeat().isSelected()) {
            config.setRepeatEnabled(true);
        } else {
            config.setRepeatEnabled(false);
        }
    }
    // Play file
    else if (cmd.equals(PlayerActionEvent.MIPLAYFILE)) {
        processEject(MouseEvent.BUTTON1_MASK);
    }
    // Play URL
    else if (cmd.equals(PlayerActionEvent.MIPLAYLOCATION)) {
        processEject(MouseEvent.BUTTON3_MASK);
    }
    // Playlist menu item
    else if (cmd.equals(PlayerActionEvent.MIPLAYLIST)) {
        ui.getAcPlaylist().setSelected(miPlaylist.getState());
        togglePlaylist();
    }
    // Playlist toggle button
    else if (cmd.equals(PlayerActionEvent.ACPLAYLIST)) {
        togglePlaylist();
    }
    // EqualizerUI menu item
    else if (cmd.equals(PlayerActionEvent.MIEQUALIZER)) {
        ui.getAcEqualizer().setSelected(miEqualizer.getState());
        toggleEqualizer();
    }
    // EqualizerUI
    else if (cmd.equals(PlayerActionEvent.ACEQUALIZER)) {
        toggleEqualizer();
    }
    // Exit player
    else if (cmd.equals(PlayerActionEvent.ACEXIT)) {
        closePlayer();
    }
    // Minimize
    else if (cmd.equals(PlayerActionEvent.ACMINIMIZE)) {
        loader.minimize();
    }
    // Eject
    else if (cmd.equals(PlayerActionEvent.ACEJECT)) {
        processEject(e.getModifiers());
    }
    // Play
    else if (cmd.equals(PlayerActionEvent.ACPLAY)) {
        processPlay(e.getModifiers());
    }
    // Pause
    else if (cmd.equals(PlayerActionEvent.ACPAUSE)) {
        processPause(e.getModifiers());
    }
    // Stop
    else if (cmd.equals(PlayerActionEvent.ACSTOP)) {
        processStop(e.getModifiers());
    }
    // Next
    else if (cmd.equals(PlayerActionEvent.ACNEXT)) {
        processNext(e.getModifiers());
    }
    // Previous
    else if (cmd.equals(PlayerActionEvent.ACPREVIOUS)) {
        processPrevious(e.getModifiers());
    }
}

From source file:edu.ucla.stat.SOCR.applications.demo.StockApplication.java

public void actionPerformed(ActionEvent evt) {

    if (evt.getSource() instanceof JComboBox) {
        JComboBox JCB = (JComboBox) evt.getSource();
        String JCB_Value = (String) JCB.getSelectedItem();
        choice = JCB_Value.substring(0, JCB_Value.indexOf(":"));
        setupInput(choice);/*  w w  w  .j  ava  2s  . c  o m*/
        updateGraph();
        chartPanel.validate();
        inputPanel.validate();
    }
    for (int i = 0; i < numInput; i++)
        if (evt.getActionCommand().equals("Input" + (i + 1))) {
            input[i] = Double.parseDouble(in[i].getText());
            updateGraph();
            chartPanel.validate();
        }

    this.getMainPanel().validate();
}

From source file:org.tsho.dmc2.core.chart.jfree.DmcChartPanel.java

/**
 * Handles action events generated by the popup menu.
 *
 * @param event  the event./*from   w  w  w . j  av  a  2s  .c o m*/
 */
public void actionPerformed(ActionEvent event) {

    String command = event.getActionCommand();

    if (command.equals(PROPERTIES_ACTION_COMMAND)) {
        attemptEditChartProperties();
    } else if (command.equals(SAVE_ACTION_COMMAND)) {
        try {
            doSaveAs();
        } catch (IOException e) {
            System.err.println("ChartPanel.doSaveAs: i/o exception = " + e.getMessage());
        }
    } else if (command.equals(PRINT_ACTION_COMMAND)) {
        createChartPrintJob();
    } else if (command.equals(ZOOM_IN_BOTH_ACTION_COMMAND)) {
        zoomInBoth(this.zoomPoint.getX(), this.zoomPoint.getY());
    } else if (command.equals(ZOOM_IN_HORIZONTAL_ACTION_COMMAND)) {
        zoomInHorizontal(this.zoomPoint.getX());
    } else if (command.equals(ZOOM_IN_VERTICAL_ACTION_COMMAND)) {
        zoomInVertical(this.zoomPoint.getY());
    } else if (command.equals(ZOOM_OUT_BOTH_ACTION_COMMAND)) {
        zoomOutBoth(this.zoomPoint.getX(), this.zoomPoint.getY());
    } else if (command.equals(ZOOM_OUT_HORIZONTAL_ACTION_COMMAND)) {
        zoomOutHorizontal(this.zoomPoint.getX());
    } else if (command.equals(ZOOM_OUT_VERTICAL_ACTION_COMMAND)) {
        zoomOutVertical(this.zoomPoint.getY());
    } else if (command.equals(AUTO_RANGE_BOTH_ACTION_COMMAND)) {
        autoRangeBoth();
    } else if (command.equals(AUTO_RANGE_HORIZONTAL_ACTION_COMMAND)) {
        autoRangeHorizontal();
    } else if (command.equals(AUTO_RANGE_VERTICAL_ACTION_COMMAND)) {
        autoRangeVertical();
    }

}

From source file:edu.harvard.i2b2.previousquery.ui.QueryPreviousRunsPanel.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("Rename ...")) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent();
        QueryMasterData ndata = (QueryMasterData) node.getUserObject();
        Object inputValue = JOptionPane.showInputDialog(this, "Rename this query to: ", "Rename Query Dialog",
                JOptionPane.PLAIN_MESSAGE, null, null,
                ndata.name().substring(0, ndata.name().lastIndexOf("[") - 1));

        if (inputValue != null) {
            String newQueryName = (String) inputValue;
            String requestXml = ndata.writeRenameQueryXML(newQueryName);

            setCursor(new Cursor(Cursor.WAIT_CURSOR));

            String response = null;
            if (System.getProperty("webServiceMethod").equals("SOAP")) {
                // TO DO
                // response =
                // QueryListNamesClient.sendQueryRequestSOAP(requestXml);
            } else {
                response = QueryListNamesClient.sendQueryRequestREST(requestXml);
            }//from  ww  w  .  j  a  v a2 s  . co m

            if (response.equalsIgnoreCase("CellDown")) {
                final JPanel parent = this;
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        JOptionPane.showMessageDialog(parent,
                                "Trouble with connection to the remote server, "
                                        + "this is often a network error, please try again",
                                "Network Error", JOptionPane.INFORMATION_MESSAGE);
                    }
                });
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                return;
            }

            if (response != null) {
                JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil();

                try {
                    JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response);
                    ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue();
                    StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus();
                    String status = statusType.getType();

                    if (status.equalsIgnoreCase("DONE")) {
                        ndata.name(newQueryName + " [" + ndata.userId() + "]");
                        node.setUserObject(ndata);
                        // DefaultMutableTreeNode parent =
                        // (DefaultMutableTreeNode) node.getParent();

                        jTree1.repaint();
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    } else if (e.getActionCommand().equalsIgnoreCase("Delete")) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent();
        QueryMasterData ndata = (QueryMasterData) node.getUserObject();
        Object selectedValue = JOptionPane.showConfirmDialog(this, "Delete Query \"" + ndata.name() + "\"?",
                "Delete Query Dialog", JOptionPane.YES_NO_OPTION);
        if (selectedValue.equals(JOptionPane.YES_OPTION)) {
            System.out.println("delete " + ndata.name());
            String requestXml = ndata.writeDeleteQueryXML();
            // System.out.println(requestXml);

            setCursor(new Cursor(Cursor.WAIT_CURSOR));

            String response = null;
            if (System.getProperty("webServiceMethod").equals("SOAP")) {
                // TO DO
                // response =
                // QueryListNamesClient.sendQueryRequestSOAP(requestXml);
            } else {
                response = QueryListNamesClient.sendQueryRequestREST(requestXml);
            }

            if (response.equalsIgnoreCase("CellDown")) {
                final JPanel parent = this;
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        JOptionPane.showMessageDialog(parent,
                                "Trouble with connection to the remote server, "
                                        + "this is often a network error, please try again",
                                "Network Error", JOptionPane.INFORMATION_MESSAGE);
                    }
                });
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                return;
            }

            if (response != null) {
                JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil();

                try {
                    JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response);
                    ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue();
                    StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus();
                    String status = statusType.getType();

                    if (status.equalsIgnoreCase("DONE")) {
                        treeModel.removeNodeFromParent(node);

                        // jTree1.repaint();
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    } else if (e.getActionCommand().equalsIgnoreCase("Refresh All")) {
        String status = loadPreviousQueries(false);
        if (status.equalsIgnoreCase("")) {
            reset(200, false);
        } else if (status.equalsIgnoreCase("CellDown")) {
            final JPanel parent = this;
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(parent,
                            "Trouble with connection to the remote server, "
                                    + "this is often a network error, please try again",
                            "Network Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
        }
    }
}

From source file:me.mayo.telnetkek.MainPanel.java

public final void setupTablePopup() {
    this.tblPlayers.addMouseListener(new MouseAdapter() {
        @Override/*from  w  w w  .  j  av a  2  s.  com*/
        public void mouseReleased(final MouseEvent mouseEvent) {
            final JTable table = MainPanel.this.tblPlayers;

            final int r = table.rowAtPoint(mouseEvent.getPoint());
            if (r >= 0 && r < table.getRowCount()) {
                table.setRowSelectionInterval(r, r);
            } else {
                table.clearSelection();
            }

            final int rowindex = table.getSelectedRow();
            if (rowindex < 0) {
                return;
            }

            if ((SwingUtilities.isRightMouseButton(mouseEvent) || mouseEvent.isControlDown())
                    && mouseEvent.getComponent() instanceof JTable) {
                final PlayerInfo player = getSelectedPlayer();
                if (player != null) {
                    final JPopupMenu popup = new JPopupMenu(player.getName());

                    final JMenuItem header = new JMenuItem("Apply action to " + player.getName() + ":");
                    header.setEnabled(false);
                    popup.add(header);

                    popup.addSeparator();

                    final ActionListener popupAction = (ActionEvent actionEvent) -> {
                        Object _source = actionEvent.getSource();
                        if (_source instanceof PlayerListPopupItem_Command) {
                            final PlayerListPopupItem_Command source = (PlayerListPopupItem_Command) _source;
                            final String output = source.getCommand().buildOutput(source.getPlayer(), true);
                            MainPanel.this.getConnectionManager().sendDelayedCommand(output, true, 100);
                        } else if (_source instanceof PlayerListPopupItem) {
                            final PlayerListPopupItem source = (PlayerListPopupItem) _source;

                            final PlayerInfo _player = source.getPlayer();

                            switch (actionEvent.getActionCommand()) {
                            case "Copy IP": {
                                copyToClipboard(_player.getIp());
                                MainPanel.this.writeToConsole(
                                        new ConsoleMessage("Copied IP to clipboard: " + _player.getIp()));
                                break;
                            }
                            case "Copy Name": {
                                copyToClipboard(_player.getName());
                                MainPanel.this.writeToConsole(
                                        new ConsoleMessage("Copied name to clipboard: " + _player.getName()));
                                break;
                            }
                            case "Copy UUID": {
                                copyToClipboard(_player.getUuid());
                                MainPanel.this.writeToConsole(
                                        new ConsoleMessage("Copied UUID to clipboard: " + _player.getUuid()));
                                break;
                            }
                            }
                        }
                    };

                    TelnetKek.config.getCommands().stream().map(
                            (command) -> new PlayerListPopupItem_Command(command.getName(), player, command))
                            .map((item) -> {
                                item.addActionListener(popupAction);
                                return item;
                            }).forEach((item) -> {
                                popup.add(item);
                            });

                    popup.addSeparator();

                    JMenuItem item;

                    item = new PlayerListPopupItem("Copy Name", player);
                    item.addActionListener(popupAction);
                    popup.add(item);

                    item = new PlayerListPopupItem("Copy IP", player);
                    item.addActionListener(popupAction);
                    popup.add(item);

                    item = new PlayerListPopupItem("Copy UUID", player);
                    item.addActionListener(popupAction);
                    popup.add(item);

                    popup.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
                }
            }
        }
    });
}

From source file:org.jets3t.apps.uploader.Uploader.java

/**
 * Handles GUI actions.//  w  w w.  ja va2 s.c o  m
 */
public void actionPerformed(ActionEvent actionEvent) {
    if ("Next".equals(actionEvent.getActionCommand())) {
        wizardStepForward();
    } else if ("Back".equals(actionEvent.getActionCommand())) {
        wizardStepBackward();
    } else if ("ChooseFile".equals(actionEvent.getActionCommand())) {
        JFileChooser fileChooser = new JFileChooser();

        if (validFileExtensions.size() > 0) {
            UploaderFileExtensionFilter filter = new UploaderFileExtensionFilter("Allowed files",
                    validFileExtensions);
            fileChooser.setFileFilter(filter);
        }

        fileChooser.setMultiSelectionEnabled(fileMaxCount > 1);
        fileChooser.setDialogTitle("Choose file" + (fileMaxCount > 1 ? "s" : "") + " to upload");
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setApproveButtonText("Choose file" + (fileMaxCount > 1 ? "s" : ""));

        int returnVal = fileChooser.showOpenDialog(ownerFrame);
        if (returnVal != JFileChooser.APPROVE_OPTION) {
            return;
        }

        List fileList = new ArrayList();
        if (fileChooser.getSelectedFiles().length > 0) {
            fileList.addAll(Arrays.asList(fileChooser.getSelectedFiles()));
        } else {
            fileList.add(fileChooser.getSelectedFile());
        }
        if (checkProposedUploadFiles(fileList)) {
            wizardStepForward();
        }
    } else if ("CancelUpload".equals(actionEvent.getActionCommand())) {
        if (uploadCancelEventTrigger != null) {
            uploadCancelEventTrigger.cancelTask(this);
            progressBar.setValue(0);
        } else {
            log.warn("Ignoring attempt to cancel file upload when cancel trigger is not available");
        }
    } else {
        log.warn("Unrecognised action command, ignoring: " + actionEvent.getActionCommand());
    }
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private JPanel buildLanguagePanel() {
    final JPanel langPanel = new JPanel();
    langPanel.setLayout(new BorderLayout());

    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(0, 1));
    buttonPanel.setBorder(/*  ww  w . j  ava2 s .  c  o  m*/
            new TitledBorder(new LineBorder(Color.BLACK), CopiedFromOtherJars.getText("msg.langPanel.border"))); //$NON-NLS-1$

    String[] localeArray = locales.keySet().toArray(new String[0]);
    Arrays.sort(localeArray);

    ActionListener localeUpdate = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            mapToolLocale = e.getActionCommand();
            // Setting the language won't work without reinitalizing the interface.
            // Instead, we just save it and use it for MapTool.
            //            CopiedFromOtherJars.setLanguage(mapToolLocale);
            updateCommand();
        }
    };
    // Always set the first button ("Default Locale") to true and let one of the others change it, if needed.
    JRadioButton jrb = new JRadioButton(CopiedFromOtherJars.getText("msg.info.defaultLocale"), true);
    jrb.setActionCommand(EMPTY);
    langGroup.add(jrb);
    buttonPanel.add(jrb);
    jrb.addActionListener(localeUpdate);

    for (String locale : localeArray) {
        String name = locale + " - " + locales.get(locale);
        jrb = new JRadioButton(name);
        jrb.setActionCommand(locale);
        jrb.addActionListener(localeUpdate);
        langGroup.add(jrb);
        buttonPanel.add(jrb);
        if (mapToolLocale.equalsIgnoreCase(locale))
            jrb.setSelected(true);
    }
    langPanel.add(buttonPanel, BorderLayout.NORTH);
    return langPanel;
}

From source file:org.gumtree.vis.plot1d.Plot1DPanel.java

@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals(LEGEND_NONE_COMMAND)) {
        getChart().getLegend().setVisible(false);
        isInternalLegendEnabled = false;
        repaint();//  w w  w  .  j  ava 2 s. c o  m
    } else if (command.equals(LEGEND_INTERNAL_COMMAND)) {
        getChart().getLegend().setVisible(false);
        isInternalLegendEnabled = true;
        repaint();
    } else if (command.equals(LEGEND_BOTTOM_COMMAND)) {
        getChart().getLegend().setVisible(true);
        getChart().getLegend().setPosition(RectangleEdge.BOTTOM);
        isInternalLegendEnabled = false;
        repaint();
    } else if (command.startsWith(LEGEND_RIGHT_COMMAND)) {
        getChart().getLegend().setVisible(true);
        getChart().getLegend().setPosition(RectangleEdge.RIGHT);
        isInternalLegendEnabled = false;
        repaint();
    } else if (command.equals(UNFOCUS_CURVE_COMMAND)) {
        selectSeries(-1);
        repaint();
    } else if (command.startsWith(FOCUS_ON_COMMAND)) {
        String[] commands = command.split("-", 2);
        if (commands.length > 1) {
            selectSeries(commands[1]);
            repaint();
        }
    } else {
        super.actionPerformed(event);
    }
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private JPanel buildTroubleshootingPanel() {
    final JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    ActionListener levelChange = new ActionListener() {
        @Override// w  ww. jav a 2s.com
        public void actionPerformed(ActionEvent e) {
            Level x = Level.parse(e.getActionCommand());
            if (Level.OFF.equals(x) || Level.INFO.equals(x) || Level.WARNING.equals(x)
                    || Level.SEVERE.equals(x))
                log.setLevel(x);
        }
    };
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new GridLayout(0, 1));
    logPanel.setBorder(new TitledBorder(new LineBorder(Color.BLACK),
            CopiedFromOtherJars.getText("msg.logDetailPanel.border"))); //$NON-NLS-1$
    logPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    ButtonGroup logGroup = new ButtonGroup();
    for (Level type : new Level[] { Level.OFF, Level.INFO, Level.WARNING, Level.SEVERE }) {
        JRadioButton jrb = new JRadioButton(type.toString());
        jrb.setActionCommand(type.toString());
        jrb.addActionListener(levelChange);
        jrb.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), jrb.getBorder()));
        logPanel.add(jrb);
        logGroup.add(jrb);
        if (type == Level.WARNING) {
            jrb.setSelected(true);
            log.setLevel(type);
        }
    }
    jcbEnableAssertions.setAlignmentX(Component.LEFT_ALIGNMENT);
    jcbEnableAssertions.setText(CopiedFromOtherJars.getText("msg.info.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.enableAssertions")); //$NON-NLS-1$
    jcbEnableAssertions.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (!extraArgs.contains(ASSERTIONS_OPTION)) {
                    extraArgs = (ASSERTIONS_OPTION + " " + extraArgs); //$NON-NLS-1$
                }
            } else if (e.getStateChange() == ItemEvent.DESELECTED) {
                extraArgs = extraArgs.replace(ASSERTIONS_OPTION, ""); //$NON-NLS-1$
            }
            extraArgs = extraArgs.trim();
            jtfArgs.setText(extraArgs);
            updateCommand();
        }
    });
    p.add(logPanel, BorderLayout.NORTH);
    Box other = new Box(BoxLayout.PAGE_AXIS);
    other.add(jcbEnableAssertions);
    other.add(Box.createVerticalGlue());
    p.add(other, BorderLayout.CENTER);
    return p;
}