DEV_BUT1/DEV2.1/TP02/Boutons.java
2023-02-08 11:18:16 +01:00

42 lines
1.4 KiB
Java

import javax.swing.*;
import java.awt.*;
public class Boutons {
public static void main(String[] args) {
// un objet pour servir de fenetre
JFrame fenetre = new JFrame();
// on configure la fenetre
fenetre.setSize(500, 300);
fenetre.setLocation(0, 0);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// un composant pour afficher du texte
JButton bouton1 = new JButton("Uvuvwevwevwe Onyetenyevwe Ugwemubwem Ossas");
bouton1.setHorizontalAlignment(JLabel.CENTER);
bouton1.setVerticalAlignment(JLabel.CENTER);
fenetre.add(bouton1, BorderLayout.CENTER);
JButton bouton2 = new JButton("oui");
bouton2.setHorizontalAlignment(JLabel.CENTER);
bouton2.setVerticalAlignment(JLabel.CENTER);
fenetre.add(bouton2, BorderLayout.SOUTH);
JButton bouton3 = new JButton("oui");
bouton3.setHorizontalAlignment(JLabel.CENTER);
bouton3.setVerticalAlignment(JLabel.CENTER);
fenetre.add(bouton3, BorderLayout.NORTH);
JButton bouton4 = new JButton("oui");
bouton4.setHorizontalAlignment(JLabel.CENTER);
bouton4.setVerticalAlignment(JLabel.CENTER);
fenetre.add(bouton4, BorderLayout.EAST);
JButton bouton5 = new JButton("oui");
bouton5.setHorizontalAlignment(JLabel.CENTER);
bouton5.setVerticalAlignment(JLabel.CENTER);
fenetre.add(bouton5, BorderLayout.WEST);
fenetre.setVisible(true);
}
}