javax.swing.JCheckBox Java Examples

The following examples show how to use javax.swing.JCheckBox. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FieldPanel.java    From sldeditor with GNU General Public License v3.0 7 votes vote down vote up
/**
 * Internal create optional checkbox.
 *
 * @param xPos the x pos
 */
private void internalCreateOptionalCheckbox(int xPos) {
    optionalCheckbox = new JCheckBox();
    optionalCheckbox.setBounds(
            xPos + 5 + BasePanel.LABEL_WIDTH,
            0,
            BasePanel.CHECKBOX_WIDTH,
            BasePanel.WIDGET_HEIGHT);
    optionalCheckbox.setVisible(false);
    optionalCheckbox.addActionListener(
            new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    handleOptionalValue();
                }
            });
    add(optionalCheckbox);
}
 
Example #2
Source File: JCheckBoxExample.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {
   JFrame frame = new JFrame("JCheckBox Example");
   check = new JCheckBox("Check here ", new ImageIcon("C:/Users/BEEP/Pictures/eclipse-debugger-continuar.png"));
   check2 = new JCheckBox("I'm a mirror");
   
   frame.getContentPane().add(check);
   frame.getContentPane().setLayout(new FlowLayout());
   frame.getContentPane().add(check2);
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setVisible(true);
   
   check.addActionListener(new ActionListener() {
      
      @Override
      public void actionPerformed(ActionEvent event) {
         check2.setSelected(((JCheckBox)event.getSource()).isSelected());
      }
   });
   
   
}
 
Example #3
Source File: CasAnnotationViewer.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the feature value check boxes.
 */
private void addFeatureValueCheckBoxes() {
  if (this.featureValueCheckBoxMap.size() == 0) {
    return;
  }

  List<JCheckBox> checkBoxes = new ArrayList<>(this.featureValueCheckBoxMap.values());
  checkBoxes.sort(new Comparator<JCheckBox>() {
    @Override
    public int compare(JCheckBox arg0, JCheckBox arg1) {
      return arg0.getText().toLowerCase().compareTo(arg1.getText().toLowerCase());
    }
  });

  for (JCheckBox checkBox : checkBoxes) {
    if (checkBox.getParent() != this.featureValueCheckBoxVerticalScrollPanel &&
        (checkBox.isSelected() || !this.hideUnselectedCheckBoxes)) {
      this.featureValueCheckBoxVerticalScrollPanel.add(checkBox);
    }
  }
}
 
Example #4
Source File: LWCheckboxPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
CheckboxDelegate() {
    super();
    cb = new JCheckBox() {
        @Override
        public boolean hasFocus() {
            return getTarget().hasFocus();
        }
    };
    rb = new JRadioButton() {
        @Override
        public boolean hasFocus() {
            return getTarget().hasFocus();
        }
    };
    setLayout(null);
    setRadioButton(false);
    add(rb);
    add(cb);
}
 
Example #5
Source File: AddressPanel.java    From importer-exporter with Apache License 2.0 6 votes vote down vote up
private void initGui() {
	exportXAL = new JRadioButton();
	exportXAL.setIconTextGap(10);
	exportDB = new JRadioButton();
	exportDB.setIconTextGap(10);
	ButtonGroup exportGroup = new ButtonGroup();
	exportGroup.add(exportXAL);
	exportGroup.add(exportDB);
	exportFallback = new JCheckBox();
	exportFallback.setIconTextGap(10);

	setLayout(new GridBagLayout());
	{
		exportXALPanel = new JPanel();
		add(exportXALPanel, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,5,0,5,0));
		exportXALPanel.setBorder(BorderFactory.createTitledBorder(""));
		exportXALPanel.setLayout(new GridBagLayout());
		{
			exportXALPanel.add(exportDB, GuiUtil.setConstraints(0,0,1.0,1.0,GridBagConstraints.BOTH,0,5,0,5));
			exportXALPanel.add(exportXAL, GuiUtil.setConstraints(0,1,1.0,1.0,GridBagConstraints.BOTH,0,5,0,5));
			exportXALPanel.add(exportFallback, GuiUtil.setConstraints(0,2,1.0,1.0,GridBagConstraints.BOTH,0,5,0,5));
		}
	}
}
 
Example #6
Source File: FmtOptions.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Very smart method which tries to set the values in the components correctly
 */
private void loadData( JComponent jc, String optionID, Preferences node ) {

    if ( jc instanceof JTextField ) {
        JTextField field = (JTextField)jc;
        field.setText( node.get(optionID, provider.getDefaultAsString(optionID)) );
    }
    else if ( jc instanceof JCheckBox ) {
        JCheckBox checkBox = (JCheckBox)jc;
        boolean df = provider.getDefaultAsBoolean(optionID);
        checkBox.setSelected( node.getBoolean(optionID, df));
    }
    else if ( jc instanceof JComboBox) {
        JComboBox cb  = (JComboBox)jc;
        String value = node.get(optionID, provider.getDefaultAsString(optionID) );
        ComboBoxModel model = createModel(value);
        cb.setModel(model);
        ComboItem item = whichItem(value, model);
        cb.setSelectedItem(item);
    }

}
 
Example #7
Source File: ButtonBuilders.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static ComponentBuilder getBuilder(Instance instance, Heap heap) {
    if (DetailsUtils.isSubclassOf(instance, JButton.class.getName())) {
        return new JButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JCheckBox.class.getName())) {
        return new JCheckBoxBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JRadioButton.class.getName())) {
        return new JRadioButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JToggleButton.class.getName())) {
        return new JToggleButtonBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JCheckBoxMenuItem.class.getName())) {
        return new JCheckBoxMenuItemBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JRadioButtonMenuItem.class.getName())) {
        return new JRadioButtonMenuItemBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenu.class.getName())) {
        return new JMenuBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenuBar.class.getName())) {
        return new JMenuBarBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JMenuItem.class.getName())) {
        return new JMenuItemBuilder(instance, heap);
    }
    return null;
}
 
Example #8
Source File: SettingsComponentFactory.java    From stendhal with GNU General Public License v2.0 6 votes vote down vote up
static JCheckBox createSettingsToggle(final String parameter, boolean defaultValue, String label, String tooltip) {
	boolean selected = false;
	JCheckBox toggle = new JCheckBox(label);
	toggle.setToolTipText(tooltip);
	selected = WtWindowManager.getInstance().getPropertyBoolean(parameter, defaultValue);
	toggle.setSelected(selected);

	toggle.addItemListener(new ItemListener(){
		@Override
		public void itemStateChanged(ItemEvent e) {
			boolean enabled = (e.getStateChange() == ItemEvent.SELECTED);
			WtWindowManager.getInstance().setProperty(parameter, Boolean.toString(enabled));
		}
	});
	return toggle;
}
 
Example #9
Source File: IncludedFractionsDesktopPane.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
private void ShowIncludedFractionCheckBox(
        AliquotInterface aliquot,
        ValueModel sampleDateModel,
        int width,
        int offset) {
    
    int count = 0;        
    for (ETFractionInterface f : ((ReduxAliquotInterface) aliquot).getAliquotFractions()) {
        JCheckBox temp = new JCheckBox();
        temp.setText(f.getFractionID());
        temp.setBounds(0, (offset + (count ++)) * 20 + 25, width, 15);
        //set checked status
        temp.setSelected(((SampleDateModel)sampleDateModel).includesFractionByName(f.getFractionID()));
        add(temp, javax.swing.JLayeredPane.DEFAULT_LAYER);
    }
    setBounds(
            getX(),
            getY(),
            width,
            (offset + ((ReduxAliquotInterface) aliquot).getAliquotFractions().size() * 20 + 25));
}
 
Example #10
Source File: PixelInfoTopComponent.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
public PixelInfoTopComponent() {
    setName(Bundle.CTL_PixelInfoTopComponentName());
    setToolTipText(Bundle.CTL_PixelInfoTopComponentDescription());
    putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED, Boolean.TRUE);
    putClientProperty(TopComponent.PROP_KEEP_PREFERRED_SIZE_WHEN_SLIDED_IN, Boolean.TRUE);
    pixelPositionListener = new MyPixelPositionListener();
    pinSelectionChangeListener = new PinSelectionChangeListener();
    pinChangedListener = new PinChangedListener();
    pixelInfoView = new PixelInfoView();
    pinCheckbox = new JCheckBox("Snap to selected pin");
    pinCheckbox.setName("pinCheckbox");
    pinCheckbox.setSelected(false);
    pinCheckbox.addActionListener(e -> updatePixelInfo());
    setLayout(new BorderLayout());
    add(pixelInfoView, BorderLayout.CENTER);
    add(pinCheckbox, BorderLayout.SOUTH);

    final SnapApp snapApp = SnapApp.getDefault();
    snapApp.getProductManager().addListener(new PxInfoProductManagerListener());
    setCurrentView(snapApp.getSelectedProductSceneView());
}
 
Example #11
Source File: MiscSettingsDialog.java    From sc2gears with Apache License 2.0 6 votes vote down vote up
public void storeSetting() {
	if ( component instanceof JSpinner )
		Settings.set( settingKey, ( (JSpinner) component ).getValue() );
	else if ( component instanceof JSlider )
		Settings.set( settingKey, ( (JSlider) component ).getValue() );
	else if ( component instanceof JTextField )
		Settings.set( settingKey, ( (JTextField) component ).getText() );
	else if ( component instanceof JCheckBox )
		Settings.set( settingKey, ( (JCheckBox) component ).isSelected() );
	else if ( component instanceof JComboBox ) {
		Settings.set( settingKey, ( (JComboBox< ? >) component ).getSelectedIndex() );
		final JComboBox< ? > comboBox = (JComboBox< ? >) component;
		if ( comboBox.isEditable() ) // It's a pre-defined list combo box
			Settings.set( settingKey, comboBox.getSelectedItem() );				
		else                         // Normal combo box
			Settings.set( settingKey, comboBox.getSelectedIndex() );				
	}
}
 
Example #12
Source File: ShelveChangesAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public HgShelveChangesSupport () {
    doBackupChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(doBackupChxBox, org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doBackupChxBox.text")); //NOI18N
    doBackupChxBox.setToolTipText(org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doBackupChxBox.desc")); //NOI18N
    doBackupChxBox.getAccessibleContext().setAccessibleDescription(doBackupChxBox.getToolTipText());
    doBackupChxBox.setSelected(HgModuleConfig.getDefault().getBackupOnRevertModifications());
    doPurgeChxBox = new JCheckBox();
    org.openide.awt.Mnemonics.setLocalizedText(doPurgeChxBox, org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doPurgeChxBox.text")); //NOI18N
    doPurgeChxBox.setToolTipText(org.openide.util.NbBundle.getMessage(ShelveChangesAction.class, "ShelvePanel.doPurgeChxBox.desc")); //NOI18N
    doPurgeChxBox.getAccessibleContext().setAccessibleDescription(doPurgeChxBox.getToolTipText());
    doPurgeChxBox.setSelected(HgModuleConfig.getDefault().isRemoveNewFilesOnRevertModifications());
    optionsPanel = new JPanel();
    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
    optionsPanel.add(doBackupChxBox);
    optionsPanel.add(doPurgeChxBox);
}
 
Example #13
Source File: MarkOccurencesPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void store() {
    Preferences node = MarkOccurencesSettings.getCurrentNode();
    for (javax.swing.JCheckBox box : boxes) {
        boolean value = box.isSelected();
        boolean original = node.getBoolean(box.getActionCommand(),
                                           DEFAULT_VALUE);

        if (value != original) {
            node.putBoolean(box.getActionCommand(), value);
        }
    }
    try {
        node.flush();
    } catch (BackingStoreException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
Example #14
Source File: RJideCheckBoxListItem.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public String getValue() {
    CheckBoxListCellRenderer cbListRenderer = (CheckBoxListCellRenderer) getComponent();
    if (cbListRenderer instanceof JComponent) {
        JList list = (JList) cbListRenderer.getClientProperty("jlist");
        if (list.getSelectedIndices().length > 1) {
            return null;
        }
    }
    Component[] childern = cbListRenderer.getComponents();
    for (Component c : childern) {
        if (c instanceof JCheckBox) {
            return String.valueOf(((JCheckBox) c).isSelected());
        }
    }
    return null;
}
 
Example #15
Source File: BuckSettingsUI.java    From buck with Apache License 2.0 6 votes vote down vote up
private JPanel initUISettingsSection() {
  autoFormatOnBlur = new JCheckBox("Auto-format build files in editor (using buildifier)");
  showDebug = new JCheckBox("Show debug in tool window");

  JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(IdeBorderFactory.createTitledBorder("UI Settings", true));

  GridBagConstraints constraints = new GridBagConstraints();
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.anchor = GridBagConstraints.LINE_START;
  constraints.weightx = 1;

  constraints.gridy = 0;
  panel.add(autoFormatOnBlur, constraints);

  constraints.gridy = 1;
  panel.add(showDebug, constraints);
  return panel;
}
 
Example #16
Source File: AqlViewer.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
private <X, Y> void viewAlgebraHelper(JComponent top, Algebra<Ty, En, Sym, Fk, Att, Gen, Sk, X, Y> algebra,
		JPanel out, JCheckBox simp, JSlider sl, Map<Pair<Boolean, Integer>, JScrollPane> cache) {
	boolean b = simp.isSelected();
	int l = sl.getValue();
	Pair<Boolean, Integer> p = new Pair<>(b, l);
	JScrollPane jsp = cache.get(p);
	if (jsp == null) {
		jsp = makeList2(algebra, b, l);
		cache.put(p, jsp);
	}
	out.removeAll();
	out.add(jsp, BorderLayout.CENTER);
	out.add(top, BorderLayout.SOUTH);
	out.revalidate();
	out.repaint();
}
 
Example #17
Source File: Test7024235.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
    if (this.pane == null) {
        this.pane = new JTabbedPane();
        this.pane.addTab("1", new Container());
        this.pane.addTab("2", new JButton());
        this.pane.addTab("3", new JCheckBox());

        JFrame frame = new JFrame();
        frame.add(BorderLayout.WEST, this.pane);
        frame.pack();
        frame.setVisible(true);

        test("first");
    }
    else {
        test("second");
        if (this.passed || AUTO) { // do not close a frame for manual review
            SwingUtilities.getWindowAncestor(this.pane).dispose();
        }
        this.pane = null;
    }
}
 
Example #18
Source File: OptionMenu.java    From Math-Game with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the types panel
 */
private void initTypes() {
	types = new ArrayList<JCheckBox>();
	for (String s : typeNames) {
		types.add(new JCheckBox(s));
	}
	typePanel = new JPanel();
	typePanel.setLayout(new GridBagLayout());
	typePanel.setOpaque(false);
	for (int i = 0; i < types.size(); i++) {
		types.get(i).setFont(eurostile24);
		gbc.fill = GridBagConstraints.HORIZONTAL;
		gbc.gridx = 0;
		gbc.gridy = i; // Layout buttons going down same column
		typePanel.add(types.get(i), gbc);
		buttonMap.put(typeNames[i], types.get(i));
		types.get(i).setOpaque(false);
		// types.get(i).addActionListener(this);
	}
}
 
Example #19
Source File: SearchThes.java    From openprodoc with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Fill the value of the attribute with the text o value of the fieldest1
 * @param Attr
 * @param jComponent
 */
private void FillAttr(Attribute Attr, JComponent JTF) throws PDException
{
if (Attr.getType()==Attribute.tSTRING)
    {
    Attr.setValue(((JTextField)JTF).getText());
    }
else if (Attr.getType()==Attribute.tDATE)
    {
    Attr.setValue((Date)((JFormattedTextField)JTF).getValue());
    }
else if (Attr.getType()==Attribute.tTIMESTAMP)
    {
    Attr.setValue((Date)((JFormattedTextField)JTF).getValue());
    }
else if (Attr.getType()==Attribute.tBOOLEAN)
    {
    Boolean Act;
    if (((JCheckBox)JTF).isSelected())
        Act=new Boolean(true);
    else
        Act=new Boolean(false);
    Attr.setValue(Act);
    }
else
    Attr.setValue("Error");
}
 
Example #20
Source File: FormPanel.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the.
 *
 * @param c the c
 */
public void add(JComponent c) {
  if (c instanceof JCheckBox)
    gbc.insets = checkBoxInsets;
  else
    gbc.insets = regularInsets;

  gbc.gridx = (componentIndex % nrColumns);
  gbc.gridy = componentIndex / nrColumns;
  gbc.anchor = anchors[gbc.gridx];
  gbc.weightx = weights[gbc.gridx];
  gridBagPanel.add(c, gbc);

  componentIndex++;
}
 
Example #21
Source File: PixelExtractionParametersForm.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private Component createKmzExportPanel(BindingContext bindingContext) {
    final TableLayout tableLayout = new TableLayout(1);
    tableLayout.setTablePadding(4, 4);
    tableLayout.setTableWeightX(1.0);
    tableLayout.setTableWeightY(0.0);
    tableLayout.setTableFill(TableLayout.Fill.BOTH);
    tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    final JPanel panel = new JPanel(tableLayout);
    final JCheckBox exportKmzBox = new JCheckBox("Export output coordinates to Google Earth (KMZ)");
    bindingContext.bind("exportKmz", exportKmzBox);
    panel.add(exportKmzBox);
    return panel;
}
 
Example #22
Source File: DataFormDialog.java    From Spark with Apache License 2.0 5 votes vote down vote up
public String getValue(String label) {
    Component comp = valueMap.get(label);
    if (comp instanceof JCheckBox) {
        return "" + ((JCheckBox)comp).isSelected();
    }

    if (comp instanceof JTextField) {
        return ((JTextField)comp).getText();
    }
    return null;
}
 
Example #23
Source File: FileCheckList.java    From pumpernickel with MIT License 5 votes vote down vote up
private static void getCheckBoxes(JComponent jc, List<JCheckBox> list) {
	if (jc instanceof JCheckBox) {
		list.add((JCheckBox) jc);
	}
	for (int a = 0; a < jc.getComponentCount(); a++) {
		if (jc.getComponent(a) instanceof JComponent) {
			getCheckBoxes((JComponent) jc.getComponent(a), list);
		}
	}
}
 
Example #24
Source File: ListDemo.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JCheckBox cb = (JCheckBox) e.getSource();
    if(cb.isSelected()) {
	listModel.addSuffix(cb.getText());
    } else {
	listModel.removeSuffix(cb.getText());
    }
}
 
Example #25
Source File: VisiblePanel.java    From Gaalop with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the set of visible objects
 * @return The set of visible objects
 */
public HashSet<String> getVisibleObjects() {
    HashSet<String> result = new HashSet<String>();
    for (JCheckBox box: boxes.keySet()) 
        if (box.isSelected())
            result.add(boxes.get(box));
    return result;
}
 
Example #26
Source File: ProcessorsMessageLocationDialog.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public boolean showRemoveDialogue(PayloadProcessorTableEntry processorTableEntry) {
    JCheckBox removeWithoutConfirmationCheckBox =
            new JCheckBox(REMOVE_DIALOG_CHECKBOX_LABEL);
    Object[] messages = {REMOVE_DIALOG_TEXT, " ", removeWithoutConfirmationCheckBox};
    int option =
            JOptionPane.showOptionDialog(
                    ProcessorsMessageLocationDialog.this,
                    messages,
                    REMOVE_DIALOG_TITLE,
                    JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    new String[] {
                        REMOVE_DIALOG_CONFIRM_BUTTON_LABEL,
                        REMOVE_DIALOG_CANCEL_BUTTON_LABEL
                    },
                    null);

    if (option == JOptionPane.OK_OPTION) {
        getRemoveWithoutConfirmationCheckBox()
                .setSelected(removeWithoutConfirmationCheckBox.isSelected());
        return true;
    }

    return false;
}
 
Example #27
Source File: KwikiDateDisplaySelectorPanel.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
private void SetUpCheckBoxes() {
    ActionListener chkBoxActionListener = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            AbstractButton abstractButton =
                    (AbstractButton) e.getSource();
            boolean[] oldValue = showDatesProperty.clone();
            showDatesProperty[Integer.parseInt(abstractButton.getActionCommand())] =//
                    !showDatesProperty[Integer.parseInt(abstractButton.getActionCommand())];
            propertySupport.firePropertyChange(SHOWDATES_PROPERTY, oldValue, showDatesProperty);
        }
    };

    dateChkBoxes = new JCheckBox[3];
    for (int i = 0; i < 3; i++) {
        dateChkBoxes[i] = new JCheckBox();
        dateChkBoxes[i].setOpaque(false);
        dateChkBoxes[i].setForeground(new java.awt.Color(204, 0, 0));
        dateChkBoxes[i].setBounds(0, 5 + (i * 22), 78, 15);
        dateChkBoxes[i].setFont(new Font("SansSerif", Font.BOLD, 10));
        dateChkBoxes[i].setSelected(showDatesProperty[i]);
        dateChkBoxes[i].setEnabled(showDatesProperty[i]);
        dateChkBoxes[i].setActionCommand(String.valueOf(i));
        dateChkBoxes[i].addActionListener(chkBoxActionListener);
        add(dateChkBoxes[i],
                javax.swing.JLayeredPane.DEFAULT_LAYER);
    }

    dateChkBoxes[0].setText("206 / 238");
    dateChkBoxes[1].setText("207 / 235");
    dateChkBoxes[2].setText("207 / 206");

}
 
Example #28
Source File: AccessorsTest.java    From jdal with Apache License 2.0 5 votes vote down vote up
@Test
public void testToggleButtonAccessor() {
	JCheckBox check = new JCheckBox("", false);
	ToggleButtonAccessor accessor = new ToggleButtonAccessor(check);
	accessor.addControlChangeListener(this);
	check.setSelected(true);
	assertEquals(true, check.isSelected());
	assertEquals(Boolean.TRUE, accessor.getControlValue());
	assertTrue(listened);
	listened = false;
}
 
Example #29
Source File: TracerViewerSettingsDialog.java    From pega-tracerviewer with Apache License 2.0 5 votes vote down vote up
protected void populateSettingsJPanel() {

        JTextField recentItemsJTextField = getRecentItemsJTextField();
        JComboBox<String> charsetJComboBox = getCharsetJComboBox();
        JCheckBox reloadPreviousFilesJComboBox = getReloadPreviousFilesJComboBox();

        String text = String.valueOf(tracerViewerSetting.getRecentItemsCount());
        recentItemsJTextField.setText(text);

        String charset = tracerViewerSetting.getCharset();
        charsetJComboBox.setSelectedItem(charset);

        boolean reloadPreviousFiles = tracerViewerSetting.isReloadPreviousFiles();
        reloadPreviousFilesJComboBox.setSelected(reloadPreviousFiles);
    }
 
Example #30
Source File: ParameterDialog.java    From FancyBing with GNU General Public License v3.0 5 votes vote down vote up
public void createComponents(int gridy, JPanel panel,
                             GridBagLayout gridbag)
{
    m_checkBox = new JCheckBox(getLabel(), m_initialValue);
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = gridy;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1.0;
    constraints.anchor = GridBagConstraints.WEST;
    gridbag.setConstraints(m_checkBox, constraints);
    panel.add(m_checkBox);
}