| 12
 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
 
 | 	public ClientGUI () {		
		// Frame propreties
		setLocation((toolkit.getScreenSize().width-800)/2, (toolkit.getScreenSize().height-600)/2); // Center of the screen
		setSize(800, 600);
		setVisible(true);
 
		// Layout
		setLayout(new GridBagLayout());
 
		// Listeners
		listener = new ClientListener(this);
		addWindowListener(listener);
 
		// Start creating Components
		GridBagConstraints g = new GridBagConstraints();
		Component temp;
 
		// 1: List
		temp = new List();
		temp.setSize(200, 200);
		g.gridx = 0; // Position
		g.gridy = 0;
		g.gridwidth = 2; // Size
		g.gridheight = 6;
		g.weightx = GridBagConstraints.REMAINDER;
		g.weighty = 0.5;
		g.anchor = GridBagConstraints.CENTER;
		g.fill = GridBagConstraints.BOTH;
		g.insets = new Insets(2,2,2,2);
		g.ipadx = 0;
		g.ipady = 0;
		add(temp,g);
 
		// 2-7: Menus
		temp = new BoutonMenu("fichiers/connect.png");
		g.gridx = 2;
		g.gridy = 0;
		g.gridwidth = 1;
		g.gridheight = 1;
		g.weightx = 0;
		g.weighty = 0;
		add(temp,g);
		temp = new BoutonMenu("fichiers/afficherserv.png");
		g.gridy = 1;
		add(temp,g);
		temp = new BoutonMenu("fichiers/afficherclients.png");
		g.gridy = 2;
		add(temp,g);
		temp = new BoutonMenu("fichiers/download.png");
		g.gridy = 3;
		add(temp,g);
		temp = new BoutonMenu("fichiers/downloadp.png");
		g.gridy = 4;
		add(temp,g);
		temp = new BoutonMenu("fichiers/downloade.png");
		g.gridy = 5;
		add(temp,g);
 
		// 8: L'entrée texte principale
		entree = new TextField();
		entree.setSize(150,15);
		entree.addKeyListener(listener);
		g.gridx = 0;
		g.gridy = 6;
		g.weightx = GridBagConstraints.REMAINDER;
		g.weighty = 0.5;
		add(entree,g);
 
		// 9: Textarea qui affiche les messages
		messages = new TextArea("Bienvenue dans FredClient !", 55, 6, TextArea.SCROLLBARS_VERTICAL_ONLY);
		messages.setEditable(false);
		messages.setSize(200,185);
		g.gridy = 7;
		g.weighty = GridBagConstraints.REMAINDER;
		add(messages,g);
 
		// Affichage modifiable
		temp = new Panel();
		temp.setSize(72,200);
		g.gridx = 1;
		g.gridy = 6;
		g.gridwidth = 2;
		g.gridheight = 2;
		g.weightx = 0.5;
		add(temp,g);
 
		validate();
	} | 
Partager