/Java_21_Words_Frame_1

A program showing how to work with another JFrame variable, JTextArea.

Primary LanguageJava

Java_21_Words_Frame_1

With the output text in a textarea the focus is on building a long string to be fed to the JTextArea constructor.

In Words.java (another Repo) each line is created by using System.out.println().

In WordsFrame.java we have a textarea containing a single string s with all lines of output:

To build s we have to concatenate each output line with s += output line

Each output line should contain the special character “\n” (i.e. go to the next line).