Example usage for javax.swing JCheckBox setActionCommand

List of usage examples for javax.swing JCheckBox setActionCommand

Introduction

In this page you can find the example usage for javax.swing JCheckBox setActionCommand.

Prototype

public void setActionCommand(String actionCommand) 

Source Link

Document

Sets the action command for this button.

Usage

From source file:Main.java

/**
 * Makes a new CheckBox with given properties.
 * /*from w  w w.ja  va 2  s. c  o  m*/
 * @param name
 *            The label of the control.
 * @param command
 *            The name the action listener is looking for.
 * @param isSelected
 *            The condition on which this control is selected.
 * @param listener
 *            The action listener.
 * @return A new CheckBox with proper default properties.
 */
public static JCheckBox createCheckBox(String name, String command, boolean isSelected,
        ActionListener listener) {
    JCheckBox button;
    button = new JCheckBox(name);
    button.setActionCommand(command);
    button.setSelected(isSelected);
    button.addActionListener(listener);
    return button;
}

From source file:com.igormaznitsa.mindmap.exporters.PNGImageExporter.java

@Override
public JComponent makeOptions() {
    final JPanel panel = UI_FACTORY.makePanel();
    final JCheckBox checkBoxExpandAll = UI_FACTORY.makeCheckBox();
    checkBoxExpandAll.setSelected(flagExpandAllNodes);
    checkBoxExpandAll.setText(BUNDLE.getString("PNGImageExporter.optionUnfoldAll"));
    checkBoxExpandAll.setActionCommand("unfold");

    final JCheckBox checkSaveBackground = UI_FACTORY.makeCheckBox();
    checkSaveBackground.setSelected(flagSaveBackground);
    checkSaveBackground.setText(BUNDLE.getString("PNGImageExporter.optionDrawBackground"));
    checkSaveBackground.setActionCommand("back");

    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    panel.add(checkBoxExpandAll);/*from   w w  w.  j  av  a 2 s . com*/
    panel.add(checkSaveBackground);

    panel.setBorder(BorderFactory.createEmptyBorder(16, 32, 16, 32));

    return panel;
}

From source file:com.igormaznitsa.mindmap.plugins.exporters.PNGImageExporter.java

@Override
@Nullable// w w  w. ja v a2  s . com
public JComponent makeOptions() {
    final JPanel panel = UI_FACTORY.makePanel();
    final JCheckBox checkBoxExpandAll = UI_FACTORY.makeCheckBox();
    checkBoxExpandAll.setSelected(flagExpandAllNodes);
    checkBoxExpandAll.setText(Texts.getString("PNGImageExporter.optionUnfoldAll"));
    checkBoxExpandAll.setActionCommand("unfold");

    final JCheckBox checkSaveBackground = UI_FACTORY.makeCheckBox();
    checkSaveBackground.setSelected(flagSaveBackground);
    checkSaveBackground.setText(Texts.getString("PNGImageExporter.optionDrawBackground"));
    checkSaveBackground.setActionCommand("back");

    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    panel.add(checkBoxExpandAll);
    panel.add(checkSaveBackground);

    panel.setBorder(BorderFactory.createEmptyBorder(16, 32, 16, 32));

    return panel;
}

From source file:es.emergya.ui.gis.popups.ListaCapas.java

private void addCapa(final GpxLayer layer) {
    final JPanel capaP = new JPanel();
    capaP.setOpaque(false);//from   w ww . j  a va  2 s  .  co  m
    layer.visible = true;
    mapView.addLayer(layer, false, capasActuales.size());
    capasActuales.add(layer);
    capaP.setLayout(new BoxLayout(capaP, BoxLayout.X_AXIS));

    final JCheckBox capa = new JCheckBox(layer.getAssociatedFile().getAbsolutePath());
    capa.setSelected(layer.visible);
    capa.setBackground(Color.WHITE);
    capa.setToolTipText(i18n.getString("window.gpx.checkbox.show.tooltip"));
    capa.setActionCommand(layer.name);
    capa.addActionListener(this);
    capaP.add(capa);
    capaP.add(Box.createHorizontalGlue());
    JButton eliminar = new JButton(LogicConstants.getIcon("button_delone"));
    eliminar.setToolTipText(i18n.getString("window.gpx.button.delete.tooltip"));
    eliminar.setBorderPainted(false);
    eliminar.setContentAreaFilled(false);

    capaP.add(eliminar);
    eliminar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            mapView.removeLayer(layer);
            mapView.repaint();
            capasGpx.remove(capaP);
            capasGpx.updateUI();
            capasActuales.remove(layer);
        }
    });

    capasGpx.add(capaP);
    capasGpx.updateUI();
}

From source file:org.graphwalker.GUI.App.java

private JCheckBox makeNavigationCheckBoxButton(String imageName, String actionCommand, String toolTipText,
        String altText) {/*w ww. ja  v a2  s. co  m*/
    // Create and initialize the button.
    JCheckBox button = new JCheckBox();
    button.setActionCommand(actionCommand);
    button.setToolTipText(toolTipText);
    button.addActionListener(this);

    button.setText(altText);

    return button;
}