2

I am facing problems changing the checkmark on the radiogroup, or color, I appreciate the help I tried the StyleBuilder, changed the font colors, but failed to change the side mark that shows the selected radiobutton

sample enter image description here

thank you,

Jari
  • 121
  • 4

1 Answers1

1

If you have static images, you can change RadioButton icons through constants in your theme.res. The applicable constants are:

radioUnselectedImage
radioUnselectedDisImage
radioSelectedImage
radioSelectedDisImage

If you don't have static images or you want to set the images dynamically in code, you may call below (before your RadioButton declaration):

float sizeMM = 3f;
int size = Display.getInstance().convertToPixels(sizeMM);
int blue = 0x73b5e3;
int white = 0xffffff;

FontImage checkedImage = FontImage.createFixed("" + FontImage.MATERIAL_CHECK, FontImage.getMaterialDesignFont(),
        blue, size, size, 0);
FontImage uncheckedImage = FontImage.createFixed("" + FontImage.MATERIAL_CHECK, FontImage.getMaterialDesignFont(),
        white, size, size, 0);
((DefaultLookAndFeel) UIManager.getInstance().getLookAndFeel())
        .setRadioButtonImages(checkedImage, uncheckedImage, checkedImage, uncheckedImage);
((DefaultLookAndFeel) UIManager.getInstance().getLookAndFeel())
        .setRadioButtonFocusImages(checkedImage, uncheckedImage, checkedImage, uncheckedImage);

Note: DefaultLookAndFeel is deprecated and may cause weird behavior, use it with caution.

Diamond
  • 7,428
  • 22
  • 37
  • In addition you can set a radio or a check box to "toggle button" mode. Then set the pressed/released and rollover icons to whatever you want. – Shai Almog Oct 18 '20 at 01:32