Exception in thread “AWT-EventQueue-0”?

You don’t ever initialize the JTextArea member field called textArea. You are shadowing the member field in your declaration. Try this:

 textArea = new JTextArea();
 textArea.setEditable(false);
 textArea.setLineWrap(true);
 textArea.setWrapStyleWord(true);

instead of

 JTextArea textArea = new JTextArea();
 textArea.setEditable(false);
 textArea.setLineWrap(true);
 textArea.setWrapStyleWord(true);

Leave a Comment