I have a question about GCheckbox objects. Depending on the control mode, the 4th & 5th parameters in the creation methods are supposed to specify either the X/Y positions (of the bottom right corner, I think) or the width/height. If I understand correctly, using control mode ‘CORNER’, they should be the width and height. But no matter which control mode I use, the checkboxes are always 20 X 20. What am I doing wrong?
I’m not sure which version of the library I have installed, the constants in ‘library.properties’ seem to be contradictory:
# A version number that increments once with each release. This is used to
# compare different versions of the same library, and check if an update is
# available. You should think of it as a counter, counting the total number of
# releases you've had.
version = 44 # This must be parsable as an int
# The version as the user will see it. If blank, the version attribute will be
# used here. This should be a single word, with no spaces.
prettyVersion = 4.3.5 # This is treated as a String
Here’s a short example:
import g4p_controls.*;
GCheckbox checkbox1 = null;
GCheckbox checkbox2 = null;
GCheckbox checkbox3 = null;
void setup () {
size(600,400,JAVA2D);
G4P.setCtrlMode(GControlMode.CORNER);
// G4P.setCtrlMode(GControlMode.CENTER);
// G4P.setCtrlMode(GControlMode.CORNERS);
G4P.setGlobalColorScheme(GCScheme.GREEN_SCHEME);
G4P.setDisplayFont("Arial", G4P.BOLD, 12);
G4P.setInputFont("Arial", G4P.BOLD, 12);
checkbox1 = new GCheckbox(this, 50, 50, 20, 20);
checkbox1.setOpaque(false);
checkbox1.addEventHandler(this,"handleCheckboxEvents");
checkbox2 = new GCheckbox(this, 50, 100, 40, 40);
checkbox2.setOpaque(false);
checkbox2.addEventHandler(this,"handleCheckboxEvents");
checkbox3 = new GCheckbox(this, 50, 150, 60, 60);
checkbox3.setOpaque(false);
checkbox3.addEventHandler(this,"handleCheckboxEvents");
}
public void draw() {
background(color(179,237,179));
}