Reputation: 4952
I have checkboxes. I have a buttongroup. When I click on the option "All Checkboxes," I want all checkboxes in the button group to be made unselectable (grayed out) (Except the "All Checkboxes" one which is selected.) How do I this?
Also, how can I add an item/set the items to a Combo Box using NetBeans?
Upvotes: 1
Views: 1123
Reputation: 347184
Also, how can I add an item/set the items to a Combo Box using NetBeans?
Just like you would with Swing normally, comboBox.setModel(comboBoxModel). Don't rely on the form editor to do it for you. Somethings you just have to get your hands dirty with.
Upvotes: 2
Reputation: 285405
I have checkboxes. I have a buttongroup. When I click on the option "All Checkboxes," I want all checkboxes in the button group to be made unselectable (grayed out) (Except the "All Checkboxes" one which is selected.) How do I this?
A ButtonGroup cannot be used to grey-out (functionally and visibly disable) a JCheckBox. Better to put them in a List<JCheckBox>
and in the ActionListener for "All CheckBoxes" iterate through calling setEnabled(true/false)
on the items in the list, the parameter depending on the state of the "All Checkboxes" JCheckBox.
Also, how can I add an item/set the items to a Combo Box using NetBeans?
I have no idea how to do this "using NetBeans", but using Swing you simply get the JComboBox's model, usually a DefaultComboBoxModel, and add items to it.
Upvotes: 2