Forums Register Login

Making radio buttons noneditable

+Pie Number of slices to send: Send
Is there any way to make a radio button noneditable? I want to use them as an indicator of what's selected, but I don't want people to click and change the selection. Is this possible? TIA.
+Pie Number of slices to send: Send
 

Originally posted by Bai Shen:
Is there any way to make a radio button noneditable? I want to use them as an indicator of what's selected, but I don't want people to click and change the selection.



Do you mean JRadioButton or JCheckBox? No matter, either way this
is what setEnabled(false) does. That will also cause the LnF to
give an indication to the user that the button is disabled, usually
by using a grey color.

If you want disabled behaviour without the greyed-out color (not
necessarily recommended) you can either mess with the painting
code or you can play tricks with the ButtonModel like this:

Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5820 times.
Similar Threads
Radio buttons
JSP
JTable
JTable help needed
radio button
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:01:32.