/** * 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.applet.Applet; import java.awt.*; import java.awt.event.*; public class ButtonApplet2 extends Applet { TextArea t; Button b; public void init () { t = new TextArea("",6,40,TextArea.SCROLLBARS_VERTICAL_ONLY); b = new Button("druecke mich"); b.addActionListener(new ButtonPressListener(this)); add(t); add(b); } //-------------------- // die geschachtelte Hilfsklasse static class ButtonPressListener implements ActionListener { ButtonApplet2 a; public ButtonPressListener(ButtonApplet2 a) { this.a = a; } public void actionPerformed(ActionEvent e) { a.t.append("autsch!!!\n"); } } } //--------------------