We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How would you change the text in a specific area by clicking.
I tried void mousePressed but am having difficulty with getting the old number to disappear.
Answers
Hello,
first you need a global variable:
boolean textHasBeenClicked = false;
in
draw()
:say
and
Thus the var shows the program what to display.
Often beginners don't use a var like that but try to display the different text when the mouse is clicked. Won't work.
Alternatively
Alternatively you can display a text in draw() via a String var.
String myText = "please press ";
in
mousePressed()
you then would change the varmyText
.No
If
necessary indraw()
then. ;-)To take this further, when you have three different texts you would instead of a boolean use an int var that can only have values 0,1,2...
To organize a whole program with this approach google states.
Chrisir ;-)
boolean textHasBeenClicked = false;
of course
;-)