1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
| import java.awt.* ;
import java.awt.event.*;
import java.applet.*;
public class Fenetre extends Applet{
protected Panel p,p1,p2,p3,p4;
protected TextArea texte;
protected Button bouton1 ;
protected CheckboxGroup cbg;
protected Checkbox chb1, chb2, chb3;
protected Choice c;
protected TextField tf1, tf2;
protected Delegue delegue;
protected Adaptateur adapt;
public void init() {
p=new Panel();
p.setLayout(new GridLayout(4,1));
p1=new Panel();
p1.setLayout(new FlowLayout());
p1.add(new Label("Type d'emprunt"));
cbg=new CheckboxGroup();
chb1=new Checkbox("immobilier", cbg, true);
p1.add(chb1);
chb2=new Checkbox("achat de véhicule", cbg, false);
p1.add(chb2);
chb3=new Checkbox("consommation", cbg, false);
p1.add(chb3);
p.add(p1);
p2=new Panel();
p2.setLayout(new FlowLayout());
p2.add(new Label("Montant demandé"));
tf1=new TextField(10);
p2.add(tf1);
p2.add(new Label("Nombres d'années de remboursement "));
c=new Choice();
c.addItem("3");
c.addItem("4");
c.addItem("5");
c.addItem("6");
c.addItem("7");
c.addItem("8");
c.addItem("9");
c.addItem("10");
c.addItem("11");
c.addItem("12");
c.addItem("13");
c.addItem("14");
c.addItem("15");
c.addItem("16");
c.addItem("17");
c.addItem("18");
c.addItem("19");
c.addItem("20");
c.addItem("21");
c.addItem("22");
c.addItem("23");
c.addItem("24");
c.addItem("25");
c.addItem("26");
c.addItem("27");
c.addItem("28");
c.addItem("29");
c.addItem("30");
p2.add(c);
p.add(p2);
p3=new Panel();
p3.setLayout(new FlowLayout());
p3.add(new Label("Revenu mensuel"));
tf2=new TextField(10);
p3.add(tf2);
p.add(p3);
p4=new Panel();
p4.setLayout(new FlowLayout());
bouton1=new Button("Valider");
p4.add(bouton1);
p.add(p4);
add("North", p);
texte=new TextArea();
add("South", texte);
delegue=new Delegue(this);
adapt=new Adaptateur(delegue);
}
}
class Delegue {
protected Fenetre fen;
Delegue(Fenetre f){
fen=f;
}
}
class Adaptateur implements WindowListener {
protected Delegue delegue;
Adaptateur(Delegue d) {
delegue=d;
}
} |
Partager