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
|
public class graphic extends JFrame{
public graphic(){
super();
build();//On initialise notre fenêtre
}
private void build(){
setTitle("Calculatrice"); //On donne un titre à l'application
setSize(400,200); //On donne une taille à notre fenêtre
setLocationRelativeTo(null); //On centre la fenêtre sur l'écran
setResizable(false); //On interdit la redimensionnement de la fenêtre
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à l'application de se fermer lors du
setContentPane(buildContentPane());
}
private JPanel buildContentPane(){
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());//cette instruction n'est pas reconnue non plus!!!!!
panel.setBackground(Color.white);
JLabel label = new JLabel("Bienvenue dans ma modeste application");
panel.add(label);
return panel;
} |
Partager