import java.applet.*; import java.awt.*; import java.awt.event.*; public class DeuxBoutons extends Applet implements ActionListener{ Button b1; Button b2; Button b3; Texte t1; Texte t2; public void init(){ t1 = new Texte("ce texte\n"); t2 = new Texte("ah ah ah\n"); b1 = new Button("clear"); b1.addActionListener(this); b2 = new Button("un listener"); b2.addActionListener(t1); b3 = new Button("deux listeners"); b3.addActionListener(t1); b3.addActionListener(t2); this.add(b1); this.add(b2); this.add(b3); this.add(t1); this.add(t2); this.setLayout(new FlowLayout()); // this.show(); } public void actionPerformed(ActionEvent e){ t1.setText(""); t2.setText(""); } } class Texte extends TextArea implements ActionListener{ String s; Texte(String st){ super(5,15); s = st; } public void actionPerformed(ActionEvent e){ this.append(s); } }