1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Panneau extends JFrame {
public Panneau() {
JPanel p = new JPanel();
p.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx=0;
c.gridy=0;
c.insets = new Insets(20, 20, 0, 0);
p.add(new Butt(),c);
c.gridx = 3;
c.insets = new Insets(0, 20, 0, 20);
p.add(new Butt(),c);
c.gridx=1;
c.gridy=1;
c.insets = new Insets(10, 40, 0, 0);
p.add(new Butt(),c);
c.gridx=3;
c.gridy=1;
c.insets = new Insets(10, 0, 0, 0);
p.add(new Butt(),c);
c.gridx=1;
c.gridy=2;
c.insets = new Insets(10, -150, 10, -20);
p.add(new Butt(),c);
c.gridx=2;
c.gridy=2;
c.insets = new Insets(10, -30, 10, 40);
p.add(new Butt(),c);
c.gridx=3;
c.gridy=2;
c.insets = new Insets(30, 0 , 0, 0);
p.add(new Butt(),c);
c.gridx=1;
c.gridy=3;
c.insets = new Insets(0, 40, 0, 0);
p.add(new Butt(),c);
this.add(p);
c.gridx=1;
c.gridy=3;
c.insets = new Insets(0, 40, 0, 0);
p.add(new Butt(),c);
this.add(p);
c.gridx=0;
c.gridy=4;
c.insets = new Insets(10, 0, 0, 10);
c.anchor= GridBagConstraints.EAST;
p.add(new Butt(),c);
this.add(p);
c.gridx=3;
c.gridy=4;
c.insets = new Insets(30, 0 , 0, 20);
p.add(new Butt(),c);
c.gridx=1;
c.gridy=5;
c.insets = new Insets(10, 0 , 0, 40);
p.add(new Butt(),c);
c.gridx=2;
c.gridy=5;
c.insets = new Insets(15, 20 , 0, 20);
p.add(new Butt(),c);
this.setSize(1370, 770);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
} |
Partager