/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class ButtonApplet3 extends JApplet { JTextArea t; JScrollPane d; JButton b; public void init () { t = new JTextArea(10,40); d = new JScrollPane(t); b = new JButton("druecke mich"); b.addActionListener(new ButtonPressListener()); setLayout(new BorderLayout()); add(d,BorderLayout.CENTER); add(b,BorderLayout.SOUTH); } //-------------------- // die geschachtelte Hilfsklasse class ButtonPressListener implements ActionListener { public void actionPerformed(ActionEvent e) { t.append("autsch!!!\n"); } } }