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
| package tuto_swing.Chapitre1.Etape2;
import javax.swing.*;
public class SimpleFenetre extends JFrame{
public SimpleFenetre(){
super();
build();//On initialise notre fenêtre
}
private void build(){
this.setTitle("Ma première application"); //On donne un titre à lapplication
this.setSize(320,240); //On donne une taille à notre fenêtre
this.setLocationRelativeTo(null); //On centre la fenêtre sur lécran
this.setResizable(false) ; //On interdit la redimensionnement de la fenêtre
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à lapplication de se fermer lors du clic sur la croix
}
public static void main(String[] args){
SimpleFenetre gui = new SimpleFenetre(); //On crée une nouvelle instance de notre fenêtre
gui.setVisible(true);
}
} |
Partager