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 113 114 115
   |  
public class VueAdmin extends Frame{
 
 
		private static VueAdmin laVue;	
		private Administration administration;
		private Label texte;	
		private Label nom;
		private Label tpv;
		private Panel haut;
		private Panel champs;
		private Panel boutton;		
		private Button valider;
		private Button quitter;
		private Image icone;
		private static TextField textNom;
		private static TextField textTPV;
		//private static TextArea reponse;
		private Panel centre = new Panel();
		private Panel champs2 = new Panel();
 
 
 
 
		public VueAdmin(Administration modeleTotalisateur,Controleur_init leControleur, String titre1)
		{
 
 
		//1.Création de la vue
			modeleTotalisateur = administration;
			laVue = this;
			setTitle(titre1);
			Font fonte = new Font("Arial",Font.PLAIN,14);
			laVue.setFont(fonte);
			laVue.setResizable(false);
 
 
		//2.creation des composants de la vue
			//Création Label
			texte=new Label("Veuillez entrer les informations suivantes :", Label.CENTER );
			textNom= new TextField(15);
			nom= new Label ("Nom de l'ordinateur", Label.CENTER);
			tpv= new Label ("Numéro TPV", Label.CENTER);
			Font fonte3 = new Font ("Arial", Font.BOLD,12);
			texte.setFont(fonte3);
			nom.setFont(fonte3);
			tpv.setFont(fonte3);
 
 
			//Création des panel
 
			textTPV = new TextField(8);
			haut=new Panel();
			champs=new Panel();
			champs2=new Panel();
			boutton=new Panel();
 
			//Création des boutons
			valider=new Button("Valider");
			quitter=new Button("Quitter");		
 
		//3.organisation des composants dans la fenetre
			haut.setLayout(new FlowLayout(0,165,10));
			centre.setLayout(new FlowLayout(0,10,0));
			champs2.setLayout(new GridLayout(2,1));
			champs.setLayout(new FlowLayout(0,45,25));			
			boutton.setLayout(new FlowLayout());
 
 
		//4.Attachage des composant				
			haut.add(texte);
			centre.add(nom);
			centre.add(textNom);
			centre.add(tpv);			
			centre.add(textTPV);
			champs2.add(haut);
			champs2.add(centre);
			boutton.add(valider);
			boutton.add(quitter);
			add(champs2,BorderLayout.NORTH);
			add(boutton,BorderLayout.SOUTH);
 
			//mise en page
			Color gris=new Color(192,192,192);
			laVue.setBackground(gris);
			texte.setBackground(gris);		
 
			Dimension dim = new Dimension (600, 200);			
			laVue.setSize(dim);
 
			icone = Toolkit.getDefaultToolkit ().getImage ("C:/Documents and Settings/dsa139/workspace/Totalisateur/src/logo-darty.jpg");
			this.setIconImage (icone);
 
		//5. mise en place des reactions
 
			quitter.addActionListener(leControleur);
			valider.addActionListener(leControleur);
			addWindowListener(leControleur);
 
 
 
		//6. phase final			
			pack();
			setLocationRelativeTo(null);
			setVisible(true);
           // A placer ici????
                      new Message();
 
 
		}
 
		public VueAdmin() {
			// TODO Auto-generated constructor stub
 
		} | 
Partager