I have constructed a JTextArea, and added that to a JScrollPane and I want to add any output to the scroll pane. I have written this...
outputText = new JTextArea(15, 40);
outputText.setEditable(false);
JScrollPane scrollPane = new JScrollPane(outputText);
contentPane.add(scrollPane, BorderLayout.CENTER);
I have already initialized the JTextArea in the constructor. I then write this...
public void println(String n)
{
outputText.append(n + "\n");
outputText.setCaretPosition(outputText.getText().length());
}
public void printWelcome()
{
println("Welcome to my Program!");
println("When you're done, press 'Done'. ");
}
But when I start my GUI, none of the text shows up. Suggestions?