import java.awt.*; public class util_listes extends java.applet.Applet { Panel p; TextField tf; liste l; Button supprime; public void init() { int i; l = new liste(); setLayout(new BorderLayout()); p = new Panel(); add("North",p); p.setLayout(new GridLayout(3,3)); for (i = 1;i <= 9;i ++) p.add(new Button(String.valueOf(i))); supprime = new Button ("Supprimer"); add("Center",supprime); tf = new TextField(20); tf.setEditable(false); add("South",tf); } public boolean action(Event e, Object arg) { try { if (e.target == supprime) { if (!l.est_vide()) l = l.fin(); } else l = new liste(new Integer(arg.toString()).intValue(),l); tf.setText(l.toString()); } catch (Exception exc) {} return (true); } }
Retour