DEV_BUT1/DEV2.1/TP03/Question.java

34 lines
976 B
Java
Raw Normal View History

2023-04-04 14:03:16 +02:00
import javax.swing.*;
import java.awt.*;
public class Question{
public static void main(String[] args) {
// un objet pour servir de fenetre
JFrame fenetre = new JFrame("Question");
// on configure la fenetre
fenetre.setSize(500, 250);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridLayout grille = new GridLayout(2,1);
fenetre.setLayout(grille);
JLabel texte = new JLabel("Aimez vous les chiens");
texte.setHorizontalAlignment(JLabel.CENTER);
fenetre.add(texte, BorderLayout.CENTER);
JPanel panneau = new JPanel();
JButton bouton = new JButton("Oui");
JButton bouton2 = new JButton("Non");
JButton bouton3 = new JButton("NSPP");
panneau.add(bouton);
panneau.add(bouton2);
panneau.add(bouton3);
fenetre.add(panneau, BorderLayout.SOUTH);
Dimension size = new Dimension(250,125);
fenetre.setMinimumSize(size);
fenetre.setVisible(true);
}
}