By default, a Processing sketch runs under a Thread called “Animation Thread”.
We can check that out by placing this statement on setup() or draw() callbacks:
println(Thread.currentThread());
Besides that 1, there’s another Thread that collects all mouse & keyboard events.
We can also create our own threads via thread():
Or we can directly use Java’s standard API for it:
However, other Processing libraries can create their own Thread.
For example, Serial’s callback serialEvent() happens in its own Thread:
You can place code there which could, for example, invoke a method from your Button class; or modify some variable that Button could check.