Reputation: 125
I have a 3 Jlist, the first contain the name of application. the second is used to put the name of application to install, the third the name of application to uninstall. but it is not beautiful. I would like to have one list with two list of radio button for each List we can choose install or uninstall but i don't know how to do that in swing.
Upvotes: 0
Views: 304
Reputation: 205785
You might look at a two-column JTable
, with the name in the first column and a JComboBox
in the second. The JComboBox
would specify install
, uninstall
or unchanged
, defaulting to unchanged
. This example shows how to specify a DefaultCellEditor
having a JComboBox
. See How to Use Tables for more. Some related alternatives are mentioned here.
Upvotes: 1
Reputation: 2088
I haven't got the scenario quite clearly.
Try this out.
Take 2 JRadioButton
, one JButtonGroup
and 3 JList
.
Set buttonGroup property of those 2 radio buttons to that JButtonGroup
. Then write codes on onClick
event of each radio button to enable the corresponding JList and disable the other JList
.
I hope this will help.
Upvotes: 0