update
This commit is contained in:
30
DEV.2.1/TP/TP3-MiseenPage/Rose.java
Normal file
30
DEV.2.1/TP/TP3-MiseenPage/Rose.java
Normal file
@@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user