Is it possible to add charts or some values into a new window created by G4P?

I could manage to open a new window with G4P. But I couldnt figure out how to add values or charts boxes or something. Is there a way

1 Like

The short answer is yes, simply add a draw handler to the new GWindow like this

import g4p_controls.*;

GWindow window;

void setup() {
  size(320, 240);
  window = GWindow.getWindow(this, "Another window", 100, 200, 480, 320, JAVA2D);
  window.addDrawHandler(this, "windowDraw");
}

void draw() {
  background(230);
  fill(255, 200, 200);
  stroke(155, 0, 155);
  strokeWeight(3);
  rect(20, 20, 200, 120);
}

void windowDraw(PApplet pa, GWinData data) {
  pa.background(32);
  pa.fill(255, 200, 200);
  pa.stroke(255, 255, 0);
  pa.strokeWeight(6);
  pa.rect(40, 30, 300, 180);
}

You can also add mouse handlers to the new window.

If you are new to G4P and Processing in general then I suggest that you install the GUI Builder tool which provides a visual design window to help you create GUIs with G4P.

There are G4P and GUI Builder guides including videos on my website also look at the examples that come with G4P.

1 Like

I have already checked your website but I found it a bit confusing for a starter but thanks I appreciate it.