Rendered RadioButton not showing a circle (0) as expected

11 views
Skip to first unread message

Mark Bolduc

unread,
Mar 24, 2020, 10:34:35 AM3/24/20
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEANetbeans 11
Desktop OS Windows 10 Pro
Simulator  Latest
Device PC, IOS, Android

        RadioButton Daily = new RadioButton("Daily");
        Daily.setOppositeSide(false);

Shows a Check Mark when selected.
Expecting a Radio Button rendering.

Please see attached "CodenameOne_Designer_RadioButton.JPG" as how the radio button is rendered in the Codenameone Designer.

However on my PC and devices, we get undesirable rendering.
Please see attached "PC and Device_RadioButton_rendering.JPG"

Thoughts?

Regards.
CodenameOne_Designer_RadioButton.JPG
PC and Device_RadioButton_rendering.JPG

Shai Almog

unread,
Mar 24, 2020, 11:10:54 PM3/24/20
to CodenameOne Discussions
That's from your theme file. Check the constants tab of the designer to see that.

Mark Bolduc

unread,
Mar 25, 2020, 9:35:30 AM3/25/20
to CodenameOne Discussions
It is not clear which constants I need to set to change the radio button showing a check mark to a round radio button.

I don't understand why this is not the default behaviour.

Can you please advise which constants need to be set and the values for them?

Attached "CurrentThemeConstantsSet_03-25-2020.JPG" are the current constants set.

Regards
CurrentThemeConstantsSet_03-25-2020.JPG

Shai Almog

unread,
Mar 25, 2020, 11:20:39 PM3/25/20
to CodenameOne Discussions
Sorry about that. On iOS there's no radio button (in the OS) so we use check marks to signify radio buttons.
If you have images of the radio button you can use the theme constants:
radioSelectedDisImage, radioSelectedImage, radioUnselectedDisImage, radioUnselectedImage,  radioSelectedDisFocusImage, radioSelectedFocusImage, radioUnselectedDisFocusImage and  radioUnselectedFocusImage

Mark Bolduc

unread,
Mar 26, 2020, 9:23:40 AM3/26/20
to CodenameOne Discussions
Thanks.

((DefaultLookAndFeel) UIManager.getInstance().getLookAndFeel()).setRadioButtonImages(radio_button_on_icon, radio_button_off_icon);
Solved my issue, however the "DefaultLookAndFeel" class is deprecated, other than using theme constants, is there another class that will 
perform the setRadioButtonImages found in "DefaultLookAndFeel" ?

Regards

Mark Bolduc

unread,
Mar 26, 2020, 9:46:15 AM3/26/20
to CodenameOne Discussions
FYI, Using the theme constant does the job.

For others that are looking for a universal radio button look and feel, I have attached the 2 (on/off) images that provide simple on and off rendering.

"RadioButtonThemeConstants.JPG" shows the constants set in the designer.
"radio-button-on-icon.png" & "radio-button-off-icon.png"

Thanks.
RadioButtonThemeConstants.JPG
radio-button-on-icon.png
radio-button-off-icon.png

Shai Almog

unread,
Mar 27, 2020, 1:58:19 AM3/27/20
to CodenameOne Discussions
The deprecation notice reads: this class is still crucial for some features in Codename One. The deprecation is here to indicate our desire to reduce usage/reliance on this class.
Some features such as radio button/checkbox images are only available there.

Reply all
Reply to author
Forward
0 new messages