A voir également:
- Placement fenêtre JAVA 2
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel football - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Waptrick java voiture - Télécharger - Jeux vidéo
- Fenêtre hors écran windows 11 - Guide
4 réponses
le_dahu
Messages postés
141
Date d'inscription
mardi 23 mars 2004
Statut
Membre
Dernière intervention
21 avril 2004
51
26 mars 2004 à 23:44
26 mars 2004 à 23:44
Salut !
Le code suivant marche très bien...
public class Fenetre extends javax.swing.JFrame {
public Fenetre() {
// Initialisation des composants...
//...
// Centrage de la fenetre
java.awt.GraphicsEnvironment graphicsEnvironment =
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
int x = graphicsEnvironment.getCenterPoint().x - getWidth() / 2;
int y = graphicsEnvironment.getCenterPoint().y - getHeight() / 2;
setLocation(x,y);
show();
} // Fin constructeur
} // Fin classe
A+
Si à gauche j'ai l'amont, c'est bon...
Si à gauche j'ai l'aval, j'suis bancal...
Le code suivant marche très bien...
public class Fenetre extends javax.swing.JFrame {
public Fenetre() {
// Initialisation des composants...
//...
// Centrage de la fenetre
java.awt.GraphicsEnvironment graphicsEnvironment =
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
int x = graphicsEnvironment.getCenterPoint().x - getWidth() / 2;
int y = graphicsEnvironment.getCenterPoint().y - getHeight() / 2;
setLocation(x,y);
show();
} // Fin constructeur
} // Fin classe
A+
Si à gauche j'ai l'amont, c'est bon...
Si à gauche j'ai l'aval, j'suis bancal...
le_dahu
Messages postés
141
Date d'inscription
mardi 23 mars 2004
Statut
Membre
Dernière intervention
21 avril 2004
51
26 mars 2004 à 23:46
26 mars 2004 à 23:46
Juste un truc : il me semble que ce n'est possible de faire ça qu'à partir de la version 1.4 de java... A priori, si tu utilises la 1.4.1 ou la 1.4.2, y a pas de pb...
A+
Si à gauche j'ai l'amont, c'est bon...
Si à gauche j'ai l'aval, j'suis bancal...
A+
Si à gauche j'ai l'amont, c'est bon...
Si à gauche j'ai l'aval, j'suis bancal...
rameur
Messages postés
135
Date d'inscription
lundi 8 avril 2002
Statut
Membre
Dernière intervention
21 janvier 2009
21
4 avril 2004 à 18:44
4 avril 2004 à 18:44
celui ci marche avec 1.3
Dimension dim = getToolkit().getScreenSize();
setLocation((dim.th- getWidth()) / 2, ((dim.height- getHeight()) / 2); j ai peut etre confondu width et height ajuste ...
Dimension dim = getToolkit().getScreenSize();
setLocation((dim.th- getWidth()) / 2, ((dim.height- getHeight()) / 2); j ai peut etre confondu width et height ajuste ...
27 mars 2004 à 19:31
27 mars 2004 à 23:23
Si à gauche j'ai l'amont, c'est bon...
Si à gauche j'ai l'aval, j'suis bancal...