So I’m trying to build a menu button that has three options and I want whenever an option is selected a certain program runs. So each program has a multiple functions like 3 to 4 function, so I’m finding it difficult to put all these functions on that one function so when option one is clicked Program 1 runs. In processing you can’t multiple functions inside one for some reason.
Main Processing flavor is based on Java.
Java prefers to encapsulate multiple functions as 1 class
:
2 Likes
Have you considered using a menu bar or other Swing component?
https://discourse.processing.org/t/swing-components-in-default-processingwindow/35483
1 Like
Always best when you show your entire code so we can take
a look.
Anyway when you are a beginner, just set an int variable myCommand (or whatever name) from the buttons to 0, 1 or 2 (or when the button has a unique id, just use this) and in the function use switch(myCommand) {… or use if(myCommand==0){…
So you can execute different code in one function depending on the button