Bonsoir,

Voila j'ai placé mes composants dans ma fenêtre mais lorsque je modifie le dimensionnement de celle-ci mes deux panels ne suivent pas et ça donne un redimensionnement un peu n'importe comment. Voici mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
package client;
 
import java.awt.BorderLayout;
import java.awt.event.KeyEvent;
 
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
 
public class InterfaceGraphique extends JFrame {
	private static final long serialVersionUID = -2040488316874518030L;
	JPanel panel = new JPanel ();
	JPanel result = new JPanel ();
	JTextArea envoieTexte = new JTextArea (5, 55);
	JTextArea receptionTexte = new JTextArea (20, 55);
	JScrollPane scrollRecept = new JScrollPane ();
	JScrollPane scrollEnvoi = new JScrollPane ();
 
		public InterfaceGraphique () {
			build (); //On initialise notre fenetre
		}
 
		private void build () {
			InputMap inputMap = this.envoieTexte.getInputMap ();
			ActionMap actionMap = this.envoieTexte.getActionMap ();
			JMenuBar menuBar = new JMenuBar ();
			JMenu menu1 = new JMenu ("Fichier");
			JMenu menu2 = new JMenu ("?");
 
			menuBar.add (menu1);
			menuBar.add (menu2);
			this.setJMenuBar (menuBar);
			this.setTitle ("Tchat"); //On donne un titre a l'application
			this.setSize (640, 480); //On donne une taille a notre fenetre
			this.setLocationRelativeTo (null); //On centre la fenêtre sur l'écran
			this.setResizable (true); //On autorise le redimensionnement de la fenetre
			this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); //On dit a l'application de se fermer lors du clic sur la croix
			this.getContentPane ().add (this.buildResult (), BorderLayout.SOUTH);
			this.getContentPane ().add (this.buildPanel (), BorderLayout.NORTH);
			inputMap.put (KeyStroke.getKeyStroke (KeyEvent.VK_ENTER, 0), "envoiTexte");
			actionMap.put ("envoiTexte", new EnvoiAction (this));
		}
 
		private JPanel buildPanel () {
			this.receptionTexte.setLineWrap (true);
			this.receptionTexte.setEditable (false);
			this.scrollRecept.setViewportView (this.receptionTexte);
			this.panel.add (this.scrollRecept);
 
			return this.panel;
		}
 
		private JPanel buildResult () {
			this.envoieTexte.setLineWrap (true);
			this.scrollEnvoi.setViewportView (this.envoieTexte);
			this.result.add (this.scrollEnvoi);
 
			return this.result;
		}
 
		public JTextArea getEnvoieTexte () {
			return this.envoieTexte;
		}
 
		public JTextArea getReceptionTexte () {
			return this.receptionTexte;
		}
 
}
Merci d'avance à ceux qui voudront bien m'aider