+public class UICheckbox extends UIButton {
+
+ private boolean firstDraw = true;
+
+ public UICheckbox(float x, float y, float w, float h) {
+ super(x, y, w, h);
+ setMomentary(false);
+ }
+
+ public void onDraw(PGraphics pg) {
+ pg.stroke(borderColor);
+ pg.fill(active ? activeColor : inactiveColor);
+ pg.rect(0, 0, h, h);
+ if (firstDraw) {
+ pg.fill(labelColor);
+ pg.textFont(defaultItemFont);
+ pg.textAlign(LEFT, CENTER);
+ pg.text(label, h + 4, h/2);
+ firstDraw = false;
+ }
+ }
+
+}
+