Im using processing 2.0b6 and guicomponents G4P.
The example I based my sketch on is G4P_imagebuttons:
/**
Demonstration of image buttons available in the G4P (GUI for
Processing) library. The button face comes from user supplied
image files.
(c) 2012 Peter Lager
*/
import guicomponents.*;
GImageButton btnGhost, btnCoins, btnTJ, btnInfo;
GLabel lblOut;
long timer;
String[] files;
void setup(){
size(580, 220);
cursor(CROSS);
String[] files;
files = new String[]{
"infooff.png", "infoover.png", "infodown.png" };
btnInfo = new GImageButton(this, "infomask.png", files, 20,14);
btnGhost = new GImageButton(this, null, "ghosts.png", 3, 40 ,90);
files = new String[]{
"tjoff.jpg", "tjover.jpg", "tjdown.jpg" };
btnTJ = new GImageButton(this, "tjmask.png", files, 150,10);
btnCoins = new GImageButton(this, null, "coins.png", 3, 400 ,20);
lblOut = new GLabel(this, "", 10, 190, 560, 20);
lblOut.setTextAlign(GAlign.CENTER);
timer = millis() - 5000;
}
void draw(){
background(220,220,255);
if(millis() - timer > 4000){
lblOut.setText("CLICK ON A BUTTON");
}
}
//btnGhost, btnCoins, btnTJ, btnInfo;
void handleImageButtonEvents(GImageButton imagebutton) {
if(imagebutton == btnGhost)
lblOut.setText("Ghosts - composite image using transparency");
else if(imagebutton == btnCoins)
lblOut.setText("Coins - composite image using transparency");
else if(imagebutton == btnTJ)
lblOut.setText("Tom & Jerry - multiple images using mask");
else if(imagebutton == btnInfo)
lblOut.setText("Info - multiple images using mask");
timer = millis();
}
I modified this sketch to show my custom buttons and it works fine.
I have a function as well:
void growScreen()
{
println("GROWSCREEN ROUTINE");
frame.setSize(screenResX-originWindowX, windowSizeY-originWindowY);
fill(255,25,5);
background(0);
ellipse((screenResX-originWindowX)/2, (windowSizeY-originWindowY)/2,ballSize,ballSize);
}
which stretches the screen size and displays a red circle in the center of the screen.
but the gui buttons are still within the larger window. I just want them gone temporarily until I do another change of window size to bring it back to the smaller window that will fit my GUI button setup...
I just tried adding window.setVisible(false);
to my sketch but that makes the entire window disappear not just the gui components (buttons).
Any ideas????