How to include G4P controls with saveFrame

Ready, I did what he asked me, and the error is with the rectangle that I add behind the image / button, the thing is that I need that rectangle because otherwise when I print data but there is a rectangle behind, the data is overwritten in Image and looks very bad. So how could I make the saveFrame () function take a real screenshot of what is seen on the screen?

Code:

import g4p_controls.*;

public void setup(){
  size(200, 200, JAVA2D); //Tamaño de la ventana principal
  createGUI();
  customGUI();
}

public void draw(){
  rect(0, 0, 200, 200,1); //Rectángulo detrás del USB.
  fill(17,34,51);//Color del Texto arriba derecha. 
}
public void customGUI(){

}

void screenshot(){
  saveFrame( "Click"+"/"+day()+"-"+month()+"-"+year()+" a las "+hour()+"_"+minute() +" con "+ second()+"s"+ ".png") ; //dar nombre de fecha a los pantallazos
}

Gui:

public void button1_click1(GButton source, GEvent event) { 
  screenshot();
} 

public void imgButton1_click1(GImageButton source, GEvent event) { 
  
} 



// Create all the GUI controls. 
// autogenerated do not edit
public void createGUI(){
  G4P.messagesEnabled(false);
  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
  G4P.setMouseOverEnabled(false);
  surface.setTitle("Sketch Window");
  button1 = new GButton(this, 64, 21, 80, 30);
  button1.setText("Save Screenshot");
  button1.addEventHandler(this, "button1_click1");
  imgButton1 = new GImageButton(this, 59, 72, 84, 103, new String[] { "usb blanco.png", "usb azul.png", "usb invertido.png" } );
  imgButton1.addEventHandler(this, "imgButton1_click1");
}

// Variable declarations 
// autogenerated do not edit
GButton button1; 
GImageButton imgButton1;
1 Like