import java.awt.*; import javax.swing.*; public class Fenetre extends JFrame { public Fenetre() { this.setSize(300, 200); this.setLocation(100, 100); GridBagLayout layout = new GridBagLayout(); this.setLayout(layout); GridBagConstraints gbc = new GridBagConstraints(); JButton b1 = new JButton("1"); JButton b2 = new JButton("2"); JButton b3 = new JButton("3"); JButton b4 = new JButton("4"); JButton b5 = new JButton("5"); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.gridheight = 1; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; this.add(b1, gbc); gbc.gridx = 2; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 2; this.add(b2, gbc); gbc.gridx = 1; gbc.gridy = 2; gbc.gridwidth = 2; gbc.gridheight = 1; this.add(b3, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 2; this.add(b4, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; this.add(b5, gbc); this.addWindowListener(new WindowControler(this)); } }