Java 8 JCheckBox - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 JCheckBox class.

This code example shows how to use the following methods:isSelected, setEnabled, setToolTipText, setVisible
        final GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.anchor = GridBagConstraints.WEST;
        panel.add(autoCompletionComboBox, gridBagConstraints);
        gridBagConstraints.gridy = 1;
 
        final JCheckBox addURLCheckBox = new JCheckBox(LocalisationHelper.getString("urlopen_dialog_add_checkbox"), false);
        final boolean aDocumentIsAlreadyOpen = gcViewer.getSelectedGCDocument() != null;
        addURLCheckBox.setVisible(aDocumentIsAlreadyOpen);
        addURLCheckBox.setEnabled(aDocumentIsAlreadyOpen);
        addURLCheckBox.setToolTipText(LocalisationHelper.getString("urlopen_dialog_hint_add_checkbox"));
        panel.add(addURLCheckBox, gridBagConstraints);
        final int result = JOptionPane.showConfirmDialog(gcViewer, panel, LocalisationHelper.getString("urlopen_dialog_title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
        if (JOptionPane.OK_OPTION == result) {
            try { 
                final URL[] urls = new URL[]{new URL((String)autoCompletionComboBox.getSelectedItem())};
                if (addURLCheckBox.isSelected()) {
                    gcViewer.add(urls);
                } 
                else { 
                    gcViewer.open(urls);
                } 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setSelected, setText, setToolTipText
        cbReadPrefs.setSelected(true);
 
        // checkbox for "allow to download private gps traces" 
        // 
        gc.gridy = 4;
        add(cbWritePrefs = new JCheckBox(), gc);
        cbWritePrefs.setText(tr("Allow to write your preferences"));
        cbWritePrefs.setToolTipText(tr("Select to grant JOSM the right to write your server preferences"));
        cbWritePrefs.setSelected(true);
 
        gc.gridy = 5;
        add(cbModifyNotes = new JCheckBox(), gc);
        cbModifyNotes.setText(tr("Allow modifications of notes"));
        cbModifyNotes.setToolTipText(tr("Select to grant JOSM the right to modify notes on your behalf"));
        cbModifyNotes.setSelected(true);
 
        // filler - grab remaining space 
        gc.gridy = 6;
        gc.fill = GridBagConstraints.BOTH;
        gc.weightx = 1.0;
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setText, setOpaque
    public CheckboxField(Element e, XhtmlForm form, LayoutContext context, BlockBox box) {
        super(e, form, context, box);
    } 
 
    public JComponent create() {
        JCheckBox checkbox = new JCheckBox();
 
        checkbox.setText("");
        checkbox.setOpaque(false);
 
        return checkbox;
    } 
     
    protected FormFieldState loadOriginalState() { 
        return FormFieldState.fromBoolean( 
                getAttribute("checked").equalsIgnoreCase("checked")); 
    } 
     
    protected void applyOriginalState() { 
        JToggleButton button = (JToggleButton) getComponent();
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addActionListener, setHorizontalAlignment, setMnemonic, setSelected, setVerticalAlignment
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addChangeListener, setBackground
 
public class TableGui extends AbstractReportGui implements ChangeListener {
 
    private static final long serialVersionUID = 240L;
 
    private JCheckBox meanCheck = new JCheckBox(JMeterUtils.getResString("average")); // $NON-NLS-1$
    private JCheckBox medianCheck = new JCheckBox(JMeterUtils.getResString("graph_results_median")); // $NON-NLS-1$
    private JCheckBox maxCheck = new JCheckBox(JMeterUtils.getResString("aggregate_report_max")); // $NON-NLS-1$
    private JCheckBox minCheck = new JCheckBox(JMeterUtils.getResString("aggregate_report_min")); // $NON-NLS-1$
    private JCheckBox responseRateCheck =
        new JCheckBox(JMeterUtils.getResString("aggregate_report_rate")); // $NON-NLS-1$
    private JCheckBox transferRateCheck =
        new JCheckBox(JMeterUtils.getResString("aggregate_report_bandwidth")); // $NON-NLS-1$
    private JCheckBox fiftypercentCheck =
        new JCheckBox(JMeterUtils.getResString("monitor_label_left_middle")); // $NON-NLS-1$
    private JCheckBox nintypercentCheck =
        new JCheckBox(JMeterUtils.getResString("aggregate_report_90")); // $NON-NLS-1$
    private JCheckBox errorRateCheck =
        new JCheckBox(JMeterUtils.getResString("aggregate_report_error")); // $NON-NLS-1$
 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setBorderPainted, setEnabled, setFocusPainted, setBackground, setBorder
    } 
 
    protected class CellRenderer implements ListCellRenderer {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            JCheckBox checkbox = (JCheckBox) value;
            checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground());
            checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground());
            checkbox.setEnabled(isEnabled());
            checkbox.setFont(getFont());
            checkbox.setFocusPainted(false);
            checkbox.setBorderPainted(true);
            checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
            return checkbox;
        } 
    } 
 
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            private JCheckBox[] boxes;
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setMnemonic, setSelected
 
      vBox.add(hBox2);
 
      Box hBox3 = Box.createHorizontalBox();
      JLabel label2 = new JLabel("Fetch missing PDBs from ftp site:");
      fromFtp = new JCheckBox();
      fromFtp.setMnemonic(KeyEvent.VK_F);
      fromFtp.setSelected(true);
      if ( config != null)
         fromFtp.setSelected(config.getAutoFetch());
 
      JLabel ftype = new JLabel("File format:");
 
      hBox3.add(Box.createGlue());
      hBox3.add(ftype);
      hBox3.add(fileType);
      hBox3.add(Box.createGlue());
      hBox3.add(label2);
      hBox3.add(fromFtp);
 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addItemListener, setSelected
        rampInput.setText("1"); // $NON-NLS-1$
        loopPanel.clearGui();
        if (showDelayedStart) {
            delayedStart.setSelected(false);
        } 
        scheduler.setSelected(false);
        Date today = new Date();
        end.setDate(today);
        start.setDate(today);
        delay.setText(""); // $NON-NLS-1$
        duration.setText(""); // $NON-NLS-1$
    } 
 
   private void init() { 
        // THREAD PROPERTIES 
        VerticalPanel threadPropsPanel = new VerticalPanel();
        threadPropsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
                JMeterUtils.getResString("thread_properties"))); // $NON-NLS-1$ 
 
        // NUMBER OF THREADS 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addItemListener, setText, setToolTipText
    } 
 
    @Override 
    protected void initUI() { 
        // do not call super.initUI() since we don't want any labels to be created 
        _checkBox = new JCheckBox();
        nameEditorComponent(_checkBox);
        if (getParameter().getProperties().getLabel() != null) { 
            _checkBox.setText(getParameter().getProperties().getLabel());
        } 
        if (getParameter().getProperties().getDescription() != null) { 
            _checkBox.setToolTipText(getParameter().getProperties().getDescription());
        } 
        _checkBox.addItemListener(new ItemListener() {
 
            public void itemStateChanged(ItemEvent event) {
                updateParameter(); 
            } 
        }); 
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:isSelected
See Code Examples for Java 8 JCheckBox Methods: