Processing, button, void

Those values in the function mousePressed()

    float x1=150;
    float y1=200;
    float w1=220;
    float h1=50;

represent one button. It’s position and size.

They must match the position on the screen, where the text / rect for this button is. You could make the variables global and use them in mousePressed() and when displaying the button. To have this in one place in the code I made the class Button in the code I linked to above.

A 2nd button

For a 2nd button use

    float x2=150;
    float y2=320; // !!!!!
    float w2=220;
    float h1=50;

for example (where the menu text is!!!)

and evaluate it with if.

To display a menu with Word etc., make a new else if (state==4).... and display the menu there…

make it in draw, in mousePressed and in keyPressed…

Chrisir