This this.setEditable(false);
needs to defined within the context of a constructor or method. It can't be called outside of these contexts.
I find it extremely strange that people insist on implementing classes in this manner, but that's just me.
Your adding no new functionality to the JPanel
, so why not just create it, a JTextarea
, a JScrollPane
and add them altogether. It will make your code more readable and solve silly mistakes like these.
Personally, a better solution would be...
JPanel menu = new JPanel() {
private static final long serialVersionUID = 1L;
};
JTextArea output = new JTextArea(5, 30) {
private static final long serialVersionUID = 4714318125998709253L;
};
output.setEditable(false);
JScrollPane scrollPane = new JScrollPane(output);
menu.add(scrollPane);