Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
JTextArea resultsTA = new JTextArea("initial text"
JScrollPane scrollPn = new JScrollPane();
contentPane.add(scrollPn, BorderLayout.CENTER);  // No center panel needed. ScrollPane added directly to frame.
JTextArea displayTA = new JTextArea("initial text");
scrollPn.setViewportView(displayTA);  // put the text area in the scroll pane

SerialVersionUID compiler warning:

A very common compiler warning to receive is the following for your frame class and other customized GUI components:

{{The serializable class XXX does not declare a static final serialVersionUID field of type long }}

If you do, add the following field to the class:

{{private static final long serialVersionUID = 42L; // Use a random, unique integer value here }}

For more information, see this web page.