Create a singelton log provider and add the "textfield" as a listener to it.
Example of the logger singelton:
interface Listener {
void log(String log);
}
enum Logger {
instance;
private List<Listener> listeners = new LinkedList<Listener>();
public void addListener(Listener l) {
synchronized(listeners) {
listeners.add(l);
}
}
public void log(String log) {
synchronized(listeners) {
for(Listener l : listeners)
l.log(log);
}
}
}
Add your listener (which you will need to implement yourself) like this:
Logger.instance.addListener(myTextField);
And use it (from any class) like this:
Logger.instance.log("Hello World!");
Or you can use a package like log4j.