Processing G4p Multiple window problem

Hi everyone, basically i have a main menu which has 3 buttons to open new window working differently. So far i can add buttons to the created window but these buttons do not response on the click anymore. I am not sure is my way the correct way to do things or anything wrong on the handleButtonEvents method. Can somebody please read my code and tell me what goes wrong?

// Tab 1
import g4p_controls.*;
import processing.serial.*;
import org.gicentre.utils.stat.*;        // For chart classes.

void setup() {
  size(200, 200);  
  createMainMenu();
}

public void draw() {
  background(255);
}
// Tab 2
GButton btnManual;
GButton btnChart;
GButton btnSmltion;

GButton btnGrasp;
GButton btnRelease;

GWindow wndManual;
GWindow wndChart;
GWindow wndSmltion;
int btnWidth = 200;
int btnHeight = 30;

public void createMainMenu() {
  btnManual = new GButton (this, 0, 0, btnWidth, btnHeight, "Manual Control");
  btnChart = new GButton (this, 0, btnHeight, btnWidth, btnHeight, "Sensing Data Chart");
  btnSmltion = new GButton (this, 0, btnHeight*2, btnWidth, btnHeight, "Simulation");
}

void handleButtonEvents(GButton button, GEvent event) {
  if (button == btnManual && event == GEvent.CLICKED && wndManual == null) {
    wndManual = new GWindow(this, "Manual Control", 0, 0, 300, 300, false, JAVA2D);
  //  wndManual.setBackground(255);
    wndManual.addDrawHandler(this, "wndManualDraw");
    wndManual.setOnTop(false);
    btnManual.setEnabled(false);

  }

  if (button == btnChart && event == GEvent.CLICKED && wndChart == null) {

    wndChart = new GWindow(this, "Sensing Data Chart", 0, 0, 600, 400, false, JAVA2D);
    wndChart.setBackground(255);
    wndChart.addDrawHandler(this, "wndChartDraw");
    wndChart.setOnTop(false);
    btnChart.setEnabled(false);
  }

  if (button == btnSmltion && event == GEvent.CLICKED && wndSmltion == null) {
    wndSmltion = new GWindow(this, "Simulation", 0, 0, 600, 600, false, JAVA2D);
    wndSmltion.setBackground(255);
    wndSmltion.addDrawHandler(this, "wndSmltionDraw");
    wndSmltion.setOnTop(false);
    btnSmltion.setEnabled(false);
  }

  if (button == btnGrasp && event == GEvent.CLICKED) {
    print ("grasp");
  }
}
// Tab 3
void wndManualDraw(GWinApplet appc, GWinData data) {
  
  appc.background(200);
  appc.fill(111);
  btnGrasp = new GButton (appc, 0, 0, btnWidth, btnHeight, "Grasp");
  btnRelease = new GButton (appc, 0, btnHeight, btnWidth, btnHeight, "Release");
}

void wndChartDraw(GWinApplet appc, GWinData data) {
}

void wndSmltionDraw(GWinApplet appc, GWinData data) {
}

I tried compiling your snippets in the Arduino IDE. Not a snowball's chance in hell. Why are you posting here?

PaulS: I tried compiling your snippets in the Arduino IDE. Not a snowball's chance in hell. Why are you posting here?

Sorry i forgot to mention its for processing IDE. I think people generally work with both Arduino and Processing.

I think people generally work with both Arduino and Processing.

I think generally you are wrong. Your question belongs in the Processing forum.