Files
DEV/DEV.2.1/TP/TP3-MiseenPage/Rose.java

30 lines
1.2 KiB
Java
Raw Normal View History

2025-01-30 15:58:46 +01:00
import javax.swing.*;
import java.awt.*;
public class Rose {
public static void main(String[] args) {
JFrame frame = new JFrame("Rose");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Créer un panel avec un GridLayout pour organiser les labels
JPanel panel = new JPanel(new GridLayout(0, 1)); // Une colonne, autant de lignes que nécessaire
// Ajouter les labels avec les noms
panel.add(new JLabel("Mystral", SwingConstants.CENTER));
panel.add(new JLabel("Tramontane", SwingConstants.CENTER));
panel.add(new JLabel("Grec", SwingConstants.CENTER));
panel.add(new JLabel("Ponant", SwingConstants.CENTER));
panel.add(new JLabel("Levant", SwingConstants.CENTER));
panel.add(new JLabel("Libeccio", SwingConstants.CENTER));
panel.add(new JLabel("Marin", SwingConstants.CENTER));
panel.add(new JLabel("Sirocco", SwingConstants.CENTER));
// Ajouter le panel à la frame
frame.add(panel, BorderLayout.CENTER);
// Configurer la taille et la position de la frame
frame.setSize(300, 200);
frame.setLocationRelativeTo(null); // Centrer la fenêtre sur l'écran
frame.setVisible(true);
}
}