Writing a line in a JTextArea from another class
- by Christopher Nastovski
I'm trying to use a Method in my class 'Visual' to write a line of code into a JTextArea and it prints when I call it from 'Visual' but when I call it from 'Login' It only prints Text into the Console, not to the TextArea.
private static Visual Visual;
Visual.WriteLine("I'm sorry, your username or password is incorrect. Please try again.");
or
private static Visual Visual = new Visual();
Visual.WriteLine("I'm sorry, your username or password is incorrect. Please try again.");
Dont work form 'Login'
But,
WriteLine("Test");
works from 'Visual', the class that the method is in.
Here's the method in 'Visual'
public void WriteLine(String Text) {
System.out.println(Text);
SystemFeed.append(Text.toString() + "\n");
SystemFeed.setCaretPosition(SystemFeed.getDocument().getLength());
}