List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox(Action a)
From source file:DefaultsDisplay.java
protected JComponent createFilterControl() { onlyVisualsCheckBox = new JCheckBox("Show Only Visual Defaults"); onlyVisualsCheckBox.setSelected(true); onlyVisualsCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { boolean showOnlyVisuals = onlyVisualsCheckBox.isSelected(); for (int i = 0; i < tabPane.getTabCount(); i++) { JScrollPane scrollpane = (JScrollPane) tabPane.getComponentAt(i); JTable table = (JTable) scrollpane.getViewport().getView(); TableRowSorter sorter = (TableRowSorter) table.getRowSorter(); sorter.setRowFilter(showOnlyVisuals ? visualsFilter : null); }//from ww w. j a v a2 s.co m } }); return onlyVisualsCheckBox; }
From source file:com.projity.dialog.ResourceMappingDialog.java
/** * Creates, intializes and configures the UI components. Real applications * may further bind the components to underlying models. *///from w w w . j av a 2s . c o m protected void initControls() { editorCombo = new JComboBox(); associationTable = new AssociationTable(); // field1=new JComboBox(form.getMergeFields()); // field1.setSelectedItem(form.getMergeField()); field1 = new JComboBox(); field1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { form.setMergeField((ResourceMappingForm.MergeField) field1.getSelectedItem()); ((AssociationTableModel) associationTable.getModel()).update(); } }); field1Label = new JLabel(Messages.getString("ResourceMappingDialog.MergeResourcesUsingField")); //$NON-NLS-1$ localProject = new JCheckBox(Messages.getString("ResourceMappingDialog.DontMergeOpenProjectReadOnly")); //$NON-NLS-1$ accessControlLabel = new JLabel(Messages.getString("ResourceMappingDialog.ProjectTeam")); //$NON-NLS-1$ accessControl = new JComboBox( new Object[] { Messages.getString("ResourceMappingDialog.AllResourcesExceptCustomerPartner"), //$NON-NLS-1$ Messages.getString("ResourceMappingDialog.BasedOnProjectRoleInResourcesView") }); //$NON-NLS-1$ HelpUtil.addDocHelp(accessControl, "Project_Team"); // localProject.addItemListener(new ItemListener(){ // public void itemStateChanged(ItemEvent e) { // accessControl.setEnabled(!accessControl.isEnabled()); // } // }); // localProject.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setLocal(localProject.isSelected()); if (masterProject != null && localProject.isSelected()) { form.setMaster(false); masterProject.setSelected(false); } } }); }
From source file:BasicDnD.java
public BasicDnD() { super(new BorderLayout()); JPanel leftPanel = createVerticalBoxPanel(); JPanel rightPanel = createVerticalBoxPanel(); //Create a table model. DefaultTableModel tm = new DefaultTableModel(); tm.addColumn("Column 0"); tm.addColumn("Column 1"); tm.addColumn("Column 2"); tm.addColumn("Column 3"); tm.addRow(new String[] { "Table 00", "Table 01", "Table 02", "Table 03" }); tm.addRow(new String[] { "Table 10", "Table 11", "Table 12", "Table 13" }); tm.addRow(new String[] { "Table 20", "Table 21", "Table 22", "Table 23" }); tm.addRow(new String[] { "Table 30", "Table 31", "Table 32", "Table 33" }); //LEFT COLUMN //Use the table model to create a table. table = new JTable(tm); leftPanel.add(createPanelForComponent(table, "JTable")); //Create a color chooser. colorChooser = new JColorChooser(); leftPanel.add(createPanelForComponent(colorChooser, "JColorChooser")); //RIGHT COLUMN //Create a textfield. textField = new JTextField(30); textField.setText("Favorite foods:\nPizza, Moussaka, Pot roast"); rightPanel.add(createPanelForComponent(textField, "JTextField")); //Create a scrolled text area. textArea = new JTextArea(5, 30); textArea.setText("Favorite shows:\nBuffy, Alias, Angel"); JScrollPane scrollPane = new JScrollPane(textArea); rightPanel.add(createPanelForComponent(scrollPane, "JTextArea")); //Create a list model and a list. DefaultListModel listModel = new DefaultListModel(); listModel.addElement("Martha Washington"); listModel.addElement("Abigail Adams"); listModel.addElement("Martha Randolph"); listModel.addElement("Dolley Madison"); listModel.addElement("Elizabeth Monroe"); listModel.addElement("Louisa Adams"); listModel.addElement("Emily Donelson"); list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); JScrollPane listView = new JScrollPane(list); listView.setPreferredSize(new Dimension(300, 100)); rightPanel.add(createPanelForComponent(listView, "JList")); //Create a tree. DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Mia Familia"); DefaultMutableTreeNode sharon = new DefaultMutableTreeNode("Sharon"); rootNode.add(sharon);/* w w w . j a v a 2 s. c o m*/ DefaultMutableTreeNode maya = new DefaultMutableTreeNode("Maya"); sharon.add(maya); DefaultMutableTreeNode anya = new DefaultMutableTreeNode("Anya"); sharon.add(anya); sharon.add(new DefaultMutableTreeNode("Bongo")); maya.add(new DefaultMutableTreeNode("Muffin")); anya.add(new DefaultMutableTreeNode("Winky")); DefaultTreeModel model = new DefaultTreeModel(rootNode); tree = new JTree(model); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); JScrollPane treeView = new JScrollPane(tree); treeView.setPreferredSize(new Dimension(300, 100)); rightPanel.add(createPanelForComponent(treeView, "JTree")); //Create the toggle button. toggleDnD = new JCheckBox("Turn on Drag and Drop"); toggleDnD.setActionCommand("toggleDnD"); toggleDnD.addActionListener(this); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel); splitPane.setOneTouchExpandable(true); add(splitPane, BorderLayout.CENTER); add(toggleDnD, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); }
From source file:au.org.ala.delta.intkey.ui.FindInTaxaDialog.java
public FindInTaxaDialog(Intkey intkeyApp) { super(intkeyApp.getMainFrame(), false); setResizable(false);//from w ww . ja v a2 s.c om ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(FindInTaxaDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); _intkeyApp = intkeyApp; _numMatchedTaxa = 0; _currentMatchedTaxon = -1; _findAction = actionMap.get("findTaxa"); _nextAction = actionMap.get("nextFoundTaxon"); this.setTitle(windowTitle); getContentPane().setLayout(new BorderLayout(0, 0)); _pnlMain = new JPanel(); _pnlMain.setBorder(new EmptyBorder(20, 20, 20, 20)); getContentPane().add(_pnlMain, BorderLayout.CENTER); _pnlMain.setLayout(new BorderLayout(0, 0)); _pnlMainTop = new JPanel(); _pnlMain.add(_pnlMainTop, BorderLayout.NORTH); _pnlMainTop.setLayout(new BoxLayout(_pnlMainTop, BoxLayout.Y_AXIS)); _lblEnterSearchString = new JLabel(enterSearchStringCaption); _lblEnterSearchString.setBorder(new EmptyBorder(0, 0, 5, 0)); _lblEnterSearchString.setHorizontalAlignment(SwingConstants.LEFT); _lblEnterSearchString.setVerticalAlignment(SwingConstants.TOP); _lblEnterSearchString.setAlignmentY(Component.TOP_ALIGNMENT); _pnlMainTop.add(_lblEnterSearchString); _textField = new JTextField(); _textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { reset(); } @Override public void insertUpdate(DocumentEvent e) { reset(); } @Override public void changedUpdate(DocumentEvent e) { reset(); } }); _pnlMainTop.add(_textField); _textField.setColumns(10); _pnlMainMiddle = new JPanel(); _pnlMainMiddle.setBorder(new EmptyBorder(10, 0, 0, 0)); _pnlMain.add(_pnlMainMiddle, BorderLayout.CENTER); _pnlMainMiddle.setLayout(new BoxLayout(_pnlMainMiddle, BoxLayout.Y_AXIS)); _rdbtnSelectOne = new JRadioButton(selectOneCaption); _rdbtnSelectOne.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainMiddle.add(_rdbtnSelectOne); _rdbtnSelectAll = new JRadioButton(selectAllCaption); _rdbtnSelectAll.setSelected(true); _rdbtnSelectAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainMiddle.add(_rdbtnSelectAll); ButtonGroup radioButtonGroup = new ButtonGroup(); radioButtonGroup.add(_rdbtnSelectOne); radioButtonGroup.add(_rdbtnSelectAll); _pnlMainBottom = new JPanel(); _pnlMain.add(_pnlMainBottom, BorderLayout.SOUTH); _pnlMainBottom.setLayout(new BoxLayout(_pnlMainBottom, BoxLayout.Y_AXIS)); _chckbxSearchSynonyms = new JCheckBox(searchSynonymsCaption); _chckbxSearchSynonyms.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchSynonyms); _chckbxSearchEliminatedTaxa = new JCheckBox(searchEliminatedTaxaCaption); _chckbxSearchEliminatedTaxa.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchEliminatedTaxa); _pnlButtons = new JPanel(); _pnlButtons.setBorder(new EmptyBorder(20, 0, 0, 10)); getContentPane().add(_pnlButtons, BorderLayout.EAST); _pnlButtons.setLayout(new BorderLayout(0, 0)); _pnlInnerButtons = new JPanel(); _pnlButtons.add(_pnlInnerButtons, BorderLayout.NORTH); GridBagLayout gbl_pnlInnerButtons = new GridBagLayout(); gbl_pnlInnerButtons.columnWidths = new int[] { 0, 0 }; gbl_pnlInnerButtons.rowHeights = new int[] { 0, 0, 0, 0 }; gbl_pnlInnerButtons.columnWeights = new double[] { 0.0, Double.MIN_VALUE }; gbl_pnlInnerButtons.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; _pnlInnerButtons.setLayout(gbl_pnlInnerButtons); _btnFindNext = new JButton(); _btnFindNext.setAction(_findAction); GridBagConstraints gbc_btnFind = new GridBagConstraints(); gbc_btnFind.fill = GridBagConstraints.HORIZONTAL; gbc_btnFind.insets = new Insets(0, 0, 5, 0); gbc_btnFind.gridx = 0; gbc_btnFind.gridy = 0; _pnlInnerButtons.add(_btnFindNext, gbc_btnFind); _btnPrevious = new JButton(); _btnPrevious.setAction(actionMap.get("previousFoundTaxon")); _btnPrevious.setEnabled(false); GridBagConstraints gbc_btnPrevious = new GridBagConstraints(); gbc_btnPrevious.insets = new Insets(0, 0, 5, 0); gbc_btnPrevious.gridx = 0; gbc_btnPrevious.gridy = 1; _pnlInnerButtons.add(_btnPrevious, gbc_btnPrevious); _btnDone = new JButton(); _btnDone.setAction(actionMap.get("findTaxaDone")); GridBagConstraints gbc_btnDone = new GridBagConstraints(); gbc_btnDone.fill = GridBagConstraints.HORIZONTAL; gbc_btnDone.gridx = 0; gbc_btnDone.gridy = 2; _pnlInnerButtons.add(_btnDone, gbc_btnDone); this.pack(); this.setLocationRelativeTo(_intkeyApp.getMainFrame()); }
From source file:SuitaDetails.java
private void initGlobal() { suiteoptions = new JPanel(); suiteoptions.setBackground(Color.WHITE); JLabel suite = new JLabel("Suite name: "); tsuite = new JTextField(); ep = new JLabel("Run on SUT:"); combo = new JList(); suitelib = new JButton("Libraries"); panicdetect = new JCheckBox("Panic Detect"); panicdetect.setBackground(Color.WHITE); JScrollPane scroll = new JScrollPane(); scroll.setViewportView(combo);/*w w w.j ava2 s . c o m*/ GroupLayout layout = new GroupLayout(suiteoptions); suiteoptions.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(panicdetect) .addComponent(suitelib, GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ep).addComponent(suite)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(tsuite) .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout .createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(suite) .addComponent(tsuite, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(panicdetect) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(suitelib)) .addComponent(ep)) .addContainerGap())); tcdelay = new JLabel("TC delay"); savedb = new JCheckBox("DB autosave"); ttcdelay = new JTextField(); JButton globallib = new JButton("Libraries"); savedb.setBackground(Color.WHITE); stoponfail = new JCheckBox("Stop on fail"); stoponfail.setBackground(Color.WHITE); JLabel prescript = new JLabel(); JLabel postscript = new JLabel(); prestoponfail = new JCheckBox("Stop on fail"); prestoponfail.setBackground(Color.WHITE); tprescript = new JTextField(); tpostscript = new JTextField(); browse1 = new JButton("..."); browse2 = new JButton("..."); prescript.setText("Pre execution script:"); postscript.setText("Post execution script:"); globallib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { showLib(); } }); suitelib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { showSuiteLib(); } }); browse1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, tprescript, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); browse2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, tpostscript, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); panicdetect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { parent.setPanicdetect(panicdetect.isSelected()); } }); layout = new GroupLayout(global); global.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addComponent(stoponfail, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(savedb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(tcdelay) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(ttcdelay, GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE).addGap(12, 12, 12) .addComponent(globallib)) .addGroup(layout.createSequentialGroup().addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(prescript).addGap(20, 20, 20)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(postscript).addGap(18, 18, 18))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tpostscript).addComponent(tprescript)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(browse1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(prestoponfail)) .addComponent(browse2)))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGap(12, 12, 12) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(stoponfail, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addComponent(savedb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(tcdelay) .addComponent(ttcdelay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(globallib)) .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(prescript) .addComponent(tprescript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(browse1).addComponent(prestoponfail)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tpostscript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(browse2).addComponent(postscript)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.linkSize(SwingConstants.VERTICAL, new Component[] { browse1, tprescript }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { browse2, tpostscript }); }
From source file:Trabalho.HistogramaHSB.java
private JPanel criaPainel() { JPanel panel = new JPanel(); JComboBox Jbox = new JComboBox(); JButton histEqual = new JButton("Equalizar Histograma"); panel.add(new JCheckBox(new HistogramaHSB.exibeAcao(0))); panel.add(new JCheckBox(new HistogramaHSB.exibeAcao(1))); panel.add(new JCheckBox(new HistogramaHSB.exibeAcao(2))); panel.add(histEqual);/*www . j a va 2 s .co m*/ panel.add(Jbox); return panel; }
From source file:net.sourceforge.atunes.kernel.modules.state.RepositoryPanel.java
/** * Initializes panel//from w w w . j a v a 2 s .co m */ public void initialize() { this.refreshTime = new JComboBox(new Integer[] { 0, 5, 10, 15, 30, 60 }); this.commandBeforeAccessRepository = this.controlsBuilder.createTextField(); this.commandBeforeAccessRepository.setColumns(20); this.commandAfterAccessRepository = this.controlsBuilder.createTextField(); this.commandAfterAccessRepository.setColumns(20); this.repositoryFoldersList = this.lookAndFeelManager.getCurrentLookAndFeel().getList(); this.repositoryFoldersList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.addFolderButton = new JButton(I18nUtils.getString("ADD")); this.removeFolderButton = new JButton(I18nUtils.getString("REMOVE")); this.repositoryFoldersList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent event) { RepositoryPanel.this.removeFolderButton .setEnabled(RepositoryPanel.this.repositoryFoldersList.getSelectedIndex() != -1); } }); this.addFolderButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent arg0) { IFolderSelectorDialog dialog = RepositoryPanel.this.dialogFactory .newDialog(IFolderSelectorDialog.class); dialog.setTitle(I18nUtils.getString("ADD_FOLDER_TO_REPOSITORY")); File folder = dialog.selectFolder(RepositoryPanel.this.osManager.getUserHome()); if (folder != null) { RepositoryPanel.this.repositoryFolders.add(folder); RepositoryPanel.this.repositoryFoldersList .setListData(RepositoryPanel.this.repositoryFolders.toArray()); } } }); this.removeFolderButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { RepositoryPanel.this.repositoryFolders .remove(RepositoryPanel.this.repositoryFoldersList.getSelectedIndex()); RepositoryPanel.this.repositoryFoldersList .setListData(RepositoryPanel.this.repositoryFolders.toArray()); } }); this.useRatingsStoredInTag = new JCheckBox(I18nUtils.getString("USE_RATINGS_STORED_IN_TAG")); setupPanel(); }
From source file:com.adito.upgrade.GUIUpgrader.java
void addUpgradeSelectionComponent() { upgradeSelectionPanel.invalidate();/* www .j a v a 2s . c o m*/ upgradeSelectionPanel.removeAll(); for (Iterator i = upgrades.iterator(); i.hasNext();) { AbstractDatabaseUpgrade upgrade = (AbstractDatabaseUpgrade) i.next(); JCheckBox box = new JCheckBox(upgrade.getName()); box.setSelected(upgrade.isSelectedByDefault()); box.setToolTipText(upgrade.getDescription()); upgradeSelectionPanel.add(box); box.putClientProperty("upgrade", upgrade); } upgradeSelectionPanel.validate(); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopOptionsGroup.java
private void addItem(final ValueWrapper item) { JToggleButton button;/*from w ww.ja v a 2s . com*/ if (multiselect) { button = new JCheckBox(item.toString()); } else { if (buttonGroup == null) buttonGroup = new ButtonGroup(); button = new JRadioButton(item.toString()); buttonGroup.add(button); } button.setEnabled(enabled && editable); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!multiselect) { Object newValue = item.getValue(); if (!Objects.equals(newValue, prevValue)) { updateInstance(newValue); fireChangeListeners(newValue); } updateMissingValueState(); } else { Set<Object> newValue = new LinkedHashSet<>(); for (Map.Entry<ValueWrapper, JToggleButton> item : items.entrySet()) { if (item.getValue().isSelected()) { newValue.add(item.getKey().getValue()); } } if ((prevValue != null && !CollectionUtils.isEqualCollection(newValue, (Collection) prevValue)) || (prevValue == null)) { updateInstance(newValue); fireChangeListeners(newValue); } updateMissingValueState(); } } }); impl.add(button); items.put(item, button); }