How can I print to a GUI TextArea
from outside the Controller
class?
I have the method
from another class called Alarm
:
public boolean maggotAttack(int nothealthy) {
int maggot = (int) (Math.random() * 2);
if (maggot == 1) {
System.out.println("A maggot is destroying the plant, heal the plant!");
return true;
} else if (maggot == 0) {
return false;
}
return false;
}
I want the print
to get printet to the GUI instead of the console. I do not want to make an instance of my Controller
and then use the TextArea
in the method
above, because that is against good software layers as far as I know.