Example usage for javax.swing JCheckBox isSelected

List of usage examples for javax.swing JCheckBox isSelected

Introduction

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

Prototype

public boolean isSelected() 

Source Link

Document

Returns the state of the button.

Usage

From source file:biomine.bmvis2.pipeline.EdgeLabelOperation.java

public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) {
    JPanel ret = new JPanel();
    ret.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = c.HORIZONTAL;/*from w w w  .  j  a v a  2s  .  co  m*/
    c.weightx = 1;
    c.weighty = 0;
    c.gridy = 0;
    final Set<String> avail = graph.getAvailableEdgeLabels();

    for (final String str : avail) {
        final JCheckBox box = new JCheckBox();
        box.setSelected(enabledLabels.contains(str));
        box.setAction(new AbstractAction(str) {
            public void actionPerformed(ActionEvent arg0) {
                if (box.isSelected() != enabledLabels.contains(str)) {
                    if (box.isSelected())
                        enabledLabels.add(str);
                    else
                        enabledLabels.remove(str);
                    v.settingsChanged(false);
                }
            }
        });
        ret.add(box, c);
        c.gridy++;
    }

    return ret;
}

From source file:biomine.bmvis2.pipeline.NodeLabelOperation.java

public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) {
    JPanel ret = new JPanel();
    ret.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;//from   w  w w.j  av a2 s. co m
    c.weighty = 0;
    c.gridy = 0;
    final Set<String> avail = graph.getAvailableNodeLabels();

    for (final String str : avail) {
        final JCheckBox box = new JCheckBox();
        box.setSelected(enabledLabels.contains(str));
        box.setAction(new AbstractAction(str) {
            public void actionPerformed(ActionEvent arg0) {
                if (box.isSelected() != enabledLabels.contains(str)) {
                    if (box.isSelected())
                        enabledLabels.add(str);
                    else
                        enabledLabels.remove(str);
                    v.settingsChanged(false);
                }
            }
        });
        ret.add(box, c);
        c.gridy++;
    }

    return ret;
}

From source file:lisong_mechlab.view.graphs.PayloadGraphPanel.java

public PayloadGraphPanel(PayloadStatistics aPayloadStatistics, final JCheckBox aSpeedTweak) {
    super(makeChart(new DefaultTableXYDataset()));
    aSpeedTweak.addActionListener(new ActionListener() {
        @Override//w  ww  . java2s .  co  m
        public void actionPerformed(ActionEvent aArg0) {
            efficiencies.setSpeedTweak(aSpeedTweak.isSelected(), null);
            updateGraph();
        }
    });
    payloadStatistics = aPayloadStatistics;
}

From source file:com.emental.mindraider.ui.dialogs.NewRdfModelJDialog.java

/**
 * Create model.//from   ww  w .ja  v  a2 s .  c  om
 * 
 * @param literalCheckBox
 *            The literal checkbox.
 */
protected void createModel(final JCheckBox literalCheckBox) {
    String subj = subjectNs.getText();
    if (StringUtils.isEmpty(subj)) {
        subjectNs.setText(MindRaiderConstants.MR_RDF_NS);
    }
    MindRaider.spidersGraph.newResource(subj + subjectLocalName.getText(), literalCheckBox.isSelected());
    MindRaider.masterToolBar.setModelLocation(SpidersGraph.MINDRAIDER_NEW_MODEL);
    dispose();
}

From source file:de.unibayreuth.bayeos.goat.options.JOptionDialog.java

private void jCheckBoxToolTipsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxToolTipsActionPerformed
    JCheckBox s = (JCheckBox) evt.getSource();
    pref.putBoolean("charttooltips", s.isSelected());
}

From source file:fll.scheduler.SchedulerUI.java

/**
 * Prompt the user for which columns represent subjective categories.
 * //from  www  . j  ava2 s .c  om
 * @param parentComponent the parent for the dialog
 * @param columnInfo the column information
 * @return the list of subjective information the user choose
 */
public static List<SubjectiveStation> gatherSubjectiveStationInformation(final Component parentComponent,
        final ColumnInformation columnInfo) {
    final List<String> unusedColumns = columnInfo.getUnusedColumns();
    final List<JCheckBox> checkboxes = new LinkedList<JCheckBox>();
    final List<JFormattedTextField> subjectiveDurations = new LinkedList<JFormattedTextField>();
    final Box optionPanel = Box.createVerticalBox();

    optionPanel.add(new JLabel("Specify which columns in the data file are for subjective judging"));

    final JPanel grid = new JPanel(new GridLayout(0, 2));
    optionPanel.add(grid);
    grid.add(new JLabel("Data file column"));
    grid.add(new JLabel("Duration (minutes)"));

    for (final String column : unusedColumns) {
        if (null != column && column.length() > 0) {
            final JCheckBox checkbox = new JCheckBox(column);
            checkboxes.add(checkbox);
            final JFormattedTextField duration = new JFormattedTextField(
                    Integer.valueOf(SchedParams.DEFAULT_SUBJECTIVE_MINUTES));
            duration.setColumns(4);
            subjectiveDurations.add(duration);
            grid.add(checkbox);
            grid.add(duration);
        }
    }
    final List<SubjectiveStation> subjectiveHeaders;
    if (!checkboxes.isEmpty()) {
        JOptionPane.showMessageDialog(parentComponent, optionPanel, "Choose Subjective Columns",
                JOptionPane.QUESTION_MESSAGE);
        subjectiveHeaders = new LinkedList<SubjectiveStation>();
        for (int i = 0; i < checkboxes.size(); ++i) {
            final JCheckBox box = checkboxes.get(i);
            final JFormattedTextField duration = subjectiveDurations.get(i);
            if (box.isSelected()) {
                subjectiveHeaders
                        .add(new SubjectiveStation(box.getText(), ((Number) duration.getValue()).intValue()));
            }
        }
    } else {
        subjectiveHeaders = Collections.emptyList();
    }

    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Subjective headers selected: " + subjectiveHeaders);
    }
    return subjectiveHeaders;
}

From source file:de.unibayreuth.bayeos.goat.options.JOptionDialog.java

private void lastUserCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lastUserCheckBoxActionPerformed
    // Add your handling code here:
    JCheckBox s = (JCheckBox) evt.getSource();
    pref.putBoolean("rememberlastconnection", s.isSelected());
}

From source file:edu.gmu.cs.sim.util.media.chart.SeriesAttributes.java

/** Builds a SeriesAttributes with the provided generator, name for the series, and index for the series.  Calls
 buildAttributes to construct custom elements in the LabelledList, then finally calls rebuildGraphicsDefinitions()
 to update the series. *///  w w  w . j ava2s .c o m
public SeriesAttributes(ChartGenerator generator, String name, int index, SeriesChangeListener stoppable) {
    super(name);
    setStoppable(stoppable);
    this.generator = generator;
    seriesIndex = index;
    final JCheckBox check = new JCheckBox();
    check.setSelected(true);
    check.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setPlotVisible(check.isSelected());
        }
    });

    manipulators = new Box(BoxLayout.X_AXIS);
    buildManipulators();
    JLabel spacer = new JLabel("");
    spacer.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
    Box b = new Box(BoxLayout.X_AXIS);
    b.add(check);
    b.add(spacer);
    b.add(manipulators);
    b.add(Box.createGlue());
    addLabelled("Show", b);

    final PropertyField nameF = new PropertyField(name) {
        public String newValue(String newValue) {
            SeriesAttributes.this.setSeriesName(newValue);
            rebuildGraphicsDefinitions();
            return newValue;
        }
    };
    addLabelled("Series", nameF);

    buildAttributes();
    rebuildGraphicsDefinitions();
}

From source file:biomine.bmvis2.pipeline.KMedoidsHighlight.java

@Override
public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) {
    Box ret = new Box(BoxLayout.X_AXIS);
    ret.add(new JLabel("k:"));

    final JSpinner spin = new JSpinner(new SpinnerNumberModel(3, 1, 1000, 1));

    spin.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            setK(((Number) spin.getValue()).intValue());
            v.settingsChanged(false);//from   www  .ja v  a 2  s .c o  m
        }
    });
    ret.add(spin);

    final JCheckBox showClustersBox = new JCheckBox("Color clusters");
    ret.add(showClustersBox);
    showClustersBox.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            showClusters = showClustersBox.isSelected();
            v.settingsChanged(false);
        }
    });
    return ret;
}

From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java

public List<String> getSelectedDependencies() {
    List<String> ret = new ArrayList<>();
    for (List<JCheckBox> chList : chkBoxesMap.values()) {
        for (JCheckBox cb : chList) {
            if (cb.isEnabled() && cb.isSelected()) {
                ret.add(cb.getName());//  ww  w  .  java  2s . co  m
            }
        }
    }
    return ret;
}