PGraphics GUIFrame = createGraphics(GUIwidth, GUIheight, JAVA2D);
color GUIbackground = color(50);
if(drawGUI && (mouseX > width-GUIwidth && mouseY < GUIheight)){
int mX = mouseX-(width-GUIwidth);
for(int i = 0; i<GUIelements.size(); i++){
((GUIelement)GUIelements.get(i)).takeInput(mX,mY);
ArrayList GUIelements = new ArrayList();
GUIelements.add(new Spacer(3));
GUIelements.add(new Slider("N of movers",7));
GUIelements.add(new Spacer());
GUIelements.add(new Checkbox("random start",2));
GUIelements.add(new Checkbox("overlap paths",6));
GUIelements.add(new Checkbox("respawn",7));
GUIelements.add(new Spacer());
GUIelements.add(new Checkbox("in color",0));
GUIelements.add(new Checkbox("smooth colors",1));
GUIelements.add(new Spacer());
GUIelements.add(new Slider("speed",0));
GUIelements.add(new Checkbox("curve lines",3));
GUIelements.add(new Checkbox("constant arcs",11));
GUIelements.add(new Slider("curliness",1));
GUIelements.add(new Spacer());
GUIelements.add(new Checkbox("sharp turns",4));
GUIelements.add(new Slider("angle size",3));
GUIelements.add(new Slider("side length",4));
GUIelements.add(new Spacer());
GUIelements.add(new Slider("size",2));
GUIelements.add(new Checkbox("shrink",9));
GUIelements.add(new Slider("shrinking time",9));
GUIelements.add(new Checkbox("sinusoidal size",5));
GUIelements.add(new Slider("size ratio",5));
GUIelements.add(new Slider("wavelength",6));
GUIelements.add(new Spacer());
GUIelements.add(new Checkbox("fade",8));
GUIelements.add(new Slider("fade speed",8));
GUIelements.add(new Spacer());
GUIelements.add(new Checkbox("wiggle",10));
GUIelements.add(new Slider("wiggle size",10));
GUIelements.add(new Slider("wiggle length",11));
for(int i = 0; i<GUIelements.size(); i++){
((GUIelement)GUIelements.get(i)).setYpos(yPosition);
yPosition += ((GUIelement)GUIelements.get(i)).getHeight();
println("GUI height: "+yPosition);
rect(width-GUIwidth,0,GUIwidth,GUIheight);
GUIFrame.background(GUIbackground);
for(int i = 0; i<GUIelements.size(); i++)
((GUIelement)GUIelements.get(i)).draw();