Bonjour !

Ce dessous la source de ma classe FenetreLancement.java :

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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
 
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
 
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
public class FenetreLancement extends JPanel{
 
	/** Attributs */
 
	private JFrame fenetre;
	private JButton tempsSession;
	private JButton tempsAffichage;
	private JButton tempsEteint;
	private JLabel labelTempsSession;
	private JLabel labelTempsAffichage;
	private JLabel labelTempsEteint;
	private JCheckBox afficherScore;
	private JButton demarrerSession;
	private JButton afficherStats;
	private JButton quitter;
	private JButton reinitialiser;
	private JTextField tempsSessionField;
 
	public FenetreLancement() {
    // Create and specify a layout manager
	build();
	fenetre.setLayout(new GridBagLayout());
 
    // Create a constraints object, and specify some default values
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH; // components grow in both dimensions
    c.insets = new Insets(5, 5, 5, 5); // 5-pixel margins on all sides
 
    // Create and add a bunch of buttons, specifying different grid
    // position, and size for each.
    // Give the first button a resize weight of 1.0 and all others
    // a weight of 0.0. The first button will get all extra space.
    tempsSession = new JButton("Temps Session");
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 3;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(tempsSession, c);
 
    tempsAffichage= new JButton("Temps Affichage");
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 3;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(tempsAffichage, c);
 
    tempsEteint = new JButton("Temps Eteint");
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 3;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(tempsEteint, c);
 
    labelTempsSession = new JLabel("Durée 0");
    c.gridx = 3;
    c.gridy = 0;
    c.gridwidth = 4;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(labelTempsSession, c);
 
    labelTempsAffichage = new JLabel("Durée 1");
    c.gridx = 3;
    c.gridy = 1;
    c.gridwidth = 4;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(labelTempsAffichage, c);
 
    labelTempsAffichage = new JLabel("Durée 2");
    c.gridx = 3;
    c.gridy = 2;
    c.gridwidth = 4;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(labelTempsAffichage, c);
 
    reinitialiser = new JButton("Réinitialiser");
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(reinitialiser, c);
 
    afficherScore = new JCheckBox("Afficher les points");
    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = 4;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(afficherScore, c);
 
    demarrerSession = new JButton("Commencer");
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(demarrerSession, c);
 
    afficherStats = new JButton("Statistiques");
    c.gridx = 2;
    c.gridy = 5;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(afficherStats, c);
 
    quitter = new JButton("Quitter");
    c.gridx = 4;
    c.gridy = 5;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(quitter, c);
 
    tempsSessionField = new JTextField("300");
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0; 
    c.weighty = 0;
    fenetre.add(tempsSessionField, c);
 
  }
 
	private void build(){
 
		fenetre = new JFrame();
		fenetre.setTitle("Entrainement");
		fenetre.setSize(640,480);
		fenetre.setLocationRelativeTo(null);
		fenetre.setResizable(true);
		fenetre.setVisible(true);
 
	}
 
  public static void main(String[] a) {
 
	FenetreLancement f = new FenetreLancement();
 
  }
}
Lors de l'execution de celle-ci, rare sont les fois où tous les elements sont affichés d'un coup (il manque des boutons...), et quand il en manque (9 fois sur 10) il suffit de resizer la fenetre avec la souris et ceux-ci apparaissent.

A quoi cela est-il du ?
Comment y remedier ?

Merci !