This is driving me nuts. I have a working text based application. It has many many variables which now need a GUI. I’m starting with the basics. Whenever some data is sent to my log, I want it to display in my textbox.
Here is a unified entry point for data to pass where it can be manipulated.
public class Log {
private static void consoleOut(String data) {
System.out.println(data);
OBD2nerConsole.update(data);
}
public static void level0(String data) {
if (Status.ConsoleLevel >= 0) {
consoleOut(data);
}
This is my form and it has a text box and a few buttons.
public class OBD2nerConsole extends java.awt.Frame {
public static void update(String data) {
textField1.setText(textField1.getText() + data);
}
}
The prolem I am having is that I am working with a static and non-static I guess.. There is nothing displayed in the text box. I kept playing around and removed all of the errors but it is not working. I don’t really know what to do. It seems that this is the best configuration, because there are no errors, but the text box is not doing anything.
I should probly add that this is my first form EVER!
If you give Log a static reference to an instance of OBD2nerConsole and remove static from update(String) you should be able to update the textField1.
Listing of modified
Log.java:Listing of
Updatable.java:Listing of modified snippet of
ODB2nerConsole.java:Listing of
Updatables.java: