import javax.swing.*; import java.awt.*; public class Rose { public static void main(String[] args) { JFrame fenetre = new JFrame("Rose"); fenetre.setSize(300, 200); fenetre.setLocation(100, 100); fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridLayout grid = new GridLayout(3, 3); fenetre.setLayout(grid); String[] nameList = new String[] {"Mystral", "Tramontane", "Grec", "Ponant", "", "Levant", "Libeccio", "Marin", "Sirocco"}; for (int i = 0; i < 9; i++) { JLabel label = new JLabel(nameList[i]); if (i % 3 == 0) label.setHorizontalAlignment(SwingConstants.LEFT); else if (i % 3 == 1) label.setHorizontalAlignment(SwingConstants.CENTER); else label.setHorizontalAlignment(SwingConstants.RIGHT); if (i < 3) label.setVerticalAlignment(SwingConstants.TOP); else if (i > 5) label.setVerticalAlignment(SwingConstants.BOTTOM); fenetre.add(label); } fenetre.setVisible(true); } }