import javax.swing.*; import java.awt.*; public class Ex2 { public static void main(String[] args) { int rows = 5; int lines = 5; JFrame fenetre = new JFrame(); fenetre.setSize(rows * 100, lines * 100); fenetre.setMinimumSize(new Dimension(rows * 100, lines * 100)); fenetre.setLocation(100, 100); fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridLayout layout = new GridLayout(lines, rows); fenetre.setLayout(layout); for (int i = 0; i < lines; i++) { for (int j = 0; j < rows; j++) { fenetre.add(new Sablier()); } } fenetre.setVisible(true); } }