public Aufgabezwei() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
textArea1.append(e);
}
});
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JTextArea textArea1 = new JTextArea();
textArea1.setText("Willkommen");
textArea1.setBounds(111, 11, 182, 127);
contentPane.add(textArea1);
}
Why do I get the error textArea1 can not be reslved at the mouseclicked event ? And how can I fix it ?