import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JTextArea; public class LoadButton extends JButton implements ActionListener { JTextArea textfeld; public LoadButton(JTextArea dasFeld) { // aufruf superconstructor entspricht // new JButton("Load"); super("Load"); textfeld = dasFeld ; // this.addActionListener(this); addActionListener(this); } public void actionPerformed(ActionEvent ae) { System.out.println("Load something"); textfeld.setText("I was loaded!"); } }