Java Code Examples for javax.swing.JCheckBox
The following examples show how to use
javax.swing.JCheckBox. These examples are extracted from open source projects.
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 Project: netbeans Source File: ButtonBuilders.java License: Apache License 2.0 | 6 votes |
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 2
Source Project: uima-uimaj Source File: CasAnnotationViewer.java License: Apache License 2.0 | 6 votes |
/** * 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 3
Source Project: netbeans Source File: ShelveChangesAction.java License: Apache License 2.0 | 6 votes |
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 4
Source Project: marathonv5 Source File: RJideCheckBoxListItem.java License: Apache License 2.0 | 6 votes |
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 5
Source Project: sc2gears Source File: MiscSettingsDialog.java License: Apache License 2.0 | 6 votes |
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 6
Source Project: buck Source File: BuckSettingsUI.java License: Apache License 2.0 | 6 votes |
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 7
Source Project: CQL Source File: AqlViewer.java License: GNU Affero General Public License v3.0 | 6 votes |
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 8
Source Project: openjdk-jdk9 Source File: Test7024235.java License: GNU General Public License v2.0 | 6 votes |
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 9
Source Project: jdk8u60 Source File: LWCheckboxPeer.java License: GNU General Public License v2.0 | 6 votes |
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 10
Source Project: ET_Redux Source File: IncludedFractionsDesktopPane.java License: Apache License 2.0 | 6 votes |
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 11
Source Project: importer-exporter Source File: AddressPanel.java License: Apache License 2.0 | 6 votes |
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 12
Source Project: snap-desktop Source File: PixelInfoTopComponent.java License: GNU General Public License v3.0 | 6 votes |
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 13
Source Project: Math-Game Source File: OptionMenu.java License: Apache License 2.0 | 6 votes |
/** * 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 14
Source Project: sldeditor Source File: FieldPanel.java License: GNU General Public License v3.0 | 6 votes |
/** * 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 15
Source Project: chuidiang-ejemplos Source File: JCheckBoxExample.java License: GNU Lesser General Public License v3.0 | 6 votes |
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 16
Source Project: netbeans Source File: MarkOccurencesPanel.java License: Apache License 2.0 | 6 votes |
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 17
Source Project: stendhal Source File: SettingsComponentFactory.java License: GNU General Public License v2.0 | 6 votes |
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 18
Source Project: netbeans Source File: FmtOptions.java License: Apache License 2.0 | 6 votes |
/** 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 19
Source Project: netcdf-java Source File: VariableTable.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * */ public void createTable() { this.setLayout(new BorderLayout()); JTable table = new JTable(dataModel); table.setPreferredScrollableViewportSize(new java.awt.Dimension(500, 70)); if (col0isDate) { table.getColumnModel().getColumn(0).setCellRenderer(new DateRenderer()); } table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); // Add the scroll pane to this panel. this.removeAll(); table.setFillsViewportHeight(true); add(scrollPane); includeGlobals = new JCheckBox("Export Attributes"); JButton export = new JButton("Export"); export.addActionListener(e -> export()); JPanel holderPanel = new JPanel(new BorderLayout()); holderPanel.add(export, BorderLayout.EAST); holderPanel.add(includeGlobals, BorderLayout.CENTER); add(holderPanel, BorderLayout.PAGE_END); }
Example 20
Source Project: snap-desktop Source File: ProductChooser.java License: GNU General Public License v3.0 | 5 votes |
private void addProductCheckers(final StringBuffer description, final JPanel checkersPane, final GridBagConstraints gbc) { final ActionListener checkListener = createActionListener(); for (int i = 0; i < allProducts.length; i++) { Product product = allProducts[i]; boolean checked = false; for (Product selectedProduct : selectedProducts) { if (product == selectedProduct) { checked = true; numSelected++; break; } } description.setLength(0); description.append(product.getDescription() == null ? "" : product.getDescription()); final JCheckBox check = new JCheckBox(getDisplayName(product), checked); check.setFont(SMALL_PLAIN_FONT); check.addActionListener(checkListener); final JLabel label = new JLabel(description.toString()); label.setFont(SMALL_ITALIC_FONT); gbc.gridy++; GridBagUtils.addToPanel(checkersPane, check, gbc, "weightx=0,gridx=0"); GridBagUtils.addToPanel(checkersPane, label, gbc, "weightx=1,gridx=1"); checkBoxes[i] = check; } }
Example 21
Source Project: jdk8u60 Source File: MetalworksPrefs.java License: GNU General Public License v2.0 | 5 votes |
public JPanel buildConnectingPanel() { JPanel connectPanel = new JPanel(); connectPanel.setLayout(new ColumnLayout()); JPanel protoPanel = new JPanel(); JLabel protoLabel = new JLabel("Protocol"); JComboBox protocol = new JComboBox(); protocol.addItem("SMTP"); protocol.addItem("IMAP"); protocol.addItem("Other..."); protoPanel.add(protoLabel); protoPanel.add(protocol); JPanel attachmentPanel = new JPanel(); JLabel attachmentLabel = new JLabel("Attachments"); JComboBox attach = new JComboBox(); attach.addItem("Download Always"); attach.addItem("Ask size > 1 Meg"); attach.addItem("Ask size > 5 Meg"); attach.addItem("Ask Always"); attachmentPanel.add(attachmentLabel); attachmentPanel.add(attach); JCheckBox autoConn = new JCheckBox("Auto Connect"); JCheckBox compress = new JCheckBox("Use Compression"); autoConn.setSelected(true); connectPanel.add(protoPanel); connectPanel.add(attachmentPanel); connectPanel.add(autoConn); connectPanel.add(compress); return connectPanel; }
Example 22
Source Project: openjdk-jdk8u-backup Source File: MetalworksPrefs.java License: GNU General Public License v2.0 | 5 votes |
public JPanel buildConnectingPanel() { JPanel connectPanel = new JPanel(); connectPanel.setLayout(new ColumnLayout()); JPanel protoPanel = new JPanel(); JLabel protoLabel = new JLabel("Protocol"); JComboBox protocol = new JComboBox(); protocol.addItem("SMTP"); protocol.addItem("IMAP"); protocol.addItem("Other..."); protoPanel.add(protoLabel); protoPanel.add(protocol); JPanel attachmentPanel = new JPanel(); JLabel attachmentLabel = new JLabel("Attachments"); JComboBox attach = new JComboBox(); attach.addItem("Download Always"); attach.addItem("Ask size > 1 Meg"); attach.addItem("Ask size > 5 Meg"); attach.addItem("Ask Always"); attachmentPanel.add(attachmentLabel); attachmentPanel.add(attach); JCheckBox autoConn = new JCheckBox("Auto Connect"); JCheckBox compress = new JCheckBox("Use Compression"); autoConn.setSelected(true); connectPanel.add(protoPanel); connectPanel.add(attachmentPanel); connectPanel.add(autoConn); connectPanel.add(compress); return connectPanel; }
Example 23
Source Project: importer-exporter Source File: CheckBoxListDecorator.java License: Apache License 2.0 | 5 votes |
public CheckBoxListDecorator(JList<T> list) { this.list = list; list.setCellRenderer(new CheckBoxListCellRenderer<T>()); list.addMouseListener(this); list.addPropertyChangeListener(this); list.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), JComponent.WHEN_FOCUSED); checkBoxSelectionModel = new DefaultListSelectionModel(); checkBoxSelectionModel.addListSelectionListener(this); enabled = new HashMap<Integer, Boolean>(); width = new JCheckBox().getPreferredSize().width; }
Example 24
Source Project: netbeans Source File: STSConfigServicePanel.java License: Apache License 2.0 | 5 votes |
private void setChBox(JCheckBox chBox, Boolean enable) { if (enable == null) { chBox.setSelected(false); } else { chBox.setSelected(enable); } }
Example 25
Source Project: importer-exporter Source File: AddressPanel.java License: Apache License 2.0 | 5 votes |
private void initGui() { importXAL = new JCheckBox(); importXAL.setIconTextGap(10); setLayout(new GridBagLayout()); { importXALPanel = new JPanel(); add(importXALPanel, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,5,0,5,0)); importXALPanel.setBorder(BorderFactory.createTitledBorder("")); importXALPanel.setLayout(new GridBagLayout()); { importXALPanel.add(importXAL, GuiUtil.setConstraints(0,0,1.0,1.0,GridBagConstraints.BOTH,0,5,0,5)); } } }
Example 26
Source Project: Astrosoft Source File: MuhurthaInput.java License: GNU General Public License v2.0 | 5 votes |
public void initComponents(){ //Init controls nakPanel = new RasiNakshathraChooser(DisplayStrings.NAK_STR.toString(Language.ENGLISH), nakChooserSize); JPanel filterPanel = new JPanel(new AbsoluteLayout()); chandraFilter = new JCheckBox(DisplayStrings.FILTER_BY_CHANDRA_STR.toString(), true); nakFilter = new JCheckBox(DisplayStrings.FILTER_BY_MUHURTHA_STR.toString()); okButton = new JButton("Ok"); filterPanel.setBorder(UIConsts.getTitleBorder(DisplayStrings.FILTER_STR.toString())); okButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ okButtonClicked(); } }); //Create filter panel LocationGenerator locGen = new LocationGenerator(origin, 0, 20); filterPanel.add(chandraFilter, new AbsoluteConstraints(locGen.getNextRow(), new Dimension(200,20))); filterPanel.add(nakFilter, new AbsoluteConstraints(locGen.getNextRow(), new Dimension(200,20))); //Add nak chooser and filter panel dlgPanel.add(nakPanel, new AbsoluteConstraints(nakPanelLoc.getLocation(), nakPanelLoc.getSize())); dlgPanel.add(filterPanel, new AbsoluteConstraints(filterPanelLoc.getLocation(), filterPanelLoc.getSize())); // Add button Dimension okButSize = new Dimension(60, 20); dlgPanel.add(okButton, new AbsoluteConstraints(new Point((dlgSize.width - okButSize.width) / 2 ,270), okButSize)); // Add outer panel add(dlgPanel); setBackground(UIConsts.THEME_CLR); setVisible(true); }
Example 27
Source Project: openAGV Source File: BooleanPropertyCellEditor.java License: Apache License 2.0 | 5 votes |
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { setValue(value); JCheckBox checkBox = (JCheckBox) getComponent(); checkBox.setBackground(table.getBackground()); if (property().getValue() instanceof Boolean) { checkBox.setSelected((boolean) property().getValue()); } return fComponent; }
Example 28
Source Project: snap-desktop Source File: PixelExtractionParametersForm.java License: GNU General Public License v3.0 | 5 votes |
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 29
Source Project: netbeans Source File: StringEditor.java License: Apache License 2.0 | 5 votes |
@Override protected Component createCustomEditorGUI(Component resourcePanelGUI) { if (resourcePanelGUI == null && ResourceSupport.isResourceableProperty(property)) { // not usable for full resourcing, only for internationalization // add a NOI18N checkbox so the user can mark the property as not to be internationalized Component customEd = delegateEditor.getCustomEditor(); JPanel panel = new JPanel(); GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); noI18nCheckbox = new JCheckBox(); Mnemonics.setLocalizedText(noI18nCheckbox, NbBundle.getMessage(StringEditor.class, "CTL_NOI18NCheckBox")); // NOI18N noI18nCheckbox.getAccessibleContext().setAccessibleDescription( NbBundle.getBundle( StringEditor.class).getString("ACD_NOI18NCheckBox")); //NOI18N layout.setHorizontalGroup(layout.createParallelGroup() .addComponent(customEd) .addGroup(layout.createSequentialGroup() .addContainerGap().addComponent(noI18nCheckbox).addContainerGap())); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(customEd).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(noI18nCheckbox)); return panel; } else { noI18nCheckbox = null; return super.createCustomEditorGUI(resourcePanelGUI); } }
Example 30
Source Project: ccu-historian Source File: DefaultNumberAxisEditor.java License: GNU General Public License v3.0 | 5 votes |
@Override protected JPanel createTickUnitPanel() { JPanel tickUnitPanel = new JPanel(new LCBLayout(3)); tickUnitPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); tickUnitPanel.add(new JPanel()); JCheckBox autoTickUnitSelectionCheckBox = new JCheckBox( localizationResources.getString("Auto-TickUnit_Selection"), isAutoTickUnitSelection()); autoTickUnitSelectionCheckBox.setActionCommand("AutoTickOnOff"); autoTickUnitSelectionCheckBox.addActionListener(this); setAutoTickUnitSelectionCheckBox(autoTickUnitSelectionCheckBox); tickUnitPanel.add(getAutoTickUnitSelectionCheckBox()); tickUnitPanel.add(new JPanel()); tickUnitPanel.add(new JLabel(localizationResources.getString( "Manual_TickUnit_value"))); this.manualTickUnit = new JTextField(Double.toString( this.manualTickUnitValue)); this.manualTickUnit.setEnabled(!isAutoTickUnitSelection()); this.manualTickUnit.setActionCommand("TickUnitValue"); this.manualTickUnit.addActionListener(this); this.manualTickUnit.addFocusListener(this); tickUnitPanel.add(this.manualTickUnit); tickUnitPanel.add(new JPanel()); return tickUnitPanel; }