G4P checkbox bigger

I want to make the G4P checkbox bigger. In the included example there’s a checkbox created by this line.

  // Checkbox
  cbxSticky = new GCheckbox(this, 230, 130, 120, 40, "Stick to ticks");
  //                              left top  wid  height?

The 120 controls the text width, but tried changing that 40 to 80 with no effect. I’ve looked on the Checkbox reference but didn’t find anything obvious. Once I’ve made the checkbox bigger I’ll want to make the font bigger as well.

All help appreciated.

Sorry that’s wrong the last 2 parameters define the overall size of the control and does not affect the text size.

There are 3 methods that can be used to set the global font and size for G4P controls
G4P.setDisplayFont(String familyName, int style, int size);
G4P.setInputFont(String familyName, int style, int size);
G4P.setSliderFont(String familyName, int style, int size);

Details can be found in the library reference here.

These methods should be called before you create any controls.

Alternatively you can set the font to be used for individual controls with
control.setFont(Font font);
see here

In this case the parameter font is an AWT font

2 Likes

Thank you. I’ve tried the different options for font name and size. So the dimensions of the control set the whole area of checkbox + font. That’s the clickable area. I came across setOpaque(true), which makes it easier to see that area. Originally I was wanting to make the actual checkbox bigger, but that keeps the same size whatever the size of the whole control. That doesn’t seem so important now, the larger text makes the whole thing more visible.

2 Likes