BUT2/DEV/DEV2.1/TP03_Mise_en_page/Q3_Question/Q3Main.java

35 lines
1.0 KiB
Java
Raw Normal View History

2023-10-23 13:23:36 +02:00
import javax.swing.*;
import java.awt.*;
public class Q3Main{
public static void main(String[] args) {
JFrame fenetre = new JFrame("Question");
fenetre.setSize(300, 200);
fenetre.setLocation(700, 300);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton reponseOui = new JButton("Oui");
JButton reponseNon = new JButton("Non");
JButton reponseNSPP = new JButton("NSPP");
JLabel texteQuestion = new JLabel("Aimez-vous les chiens ?", JLabel.CENTER);
texteQuestion.setPreferredSize(new Dimension(10000,30));
FlowLayout grilleQuestion = new FlowLayout(FlowLayout.CENTER);
JPanel panneauQuestion = new JPanel();
panneauQuestion.setLayout(grilleQuestion);
panneauQuestion.add(texteQuestion);
panneauQuestion.add(reponseOui);
panneauQuestion.add(reponseNon);
panneauQuestion.add(reponseNSPP);
JPanel vide = new JPanel();
vide.setPreferredSize(new Dimension(10000,50));
fenetre.add(vide, BorderLayout.NORTH);
fenetre.add(panneauQuestion, BorderLayout.CENTER);
fenetre.setVisible(true);
}
}