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 90 91 92 93 94 95 96 97
| // METHODE DE LA FENETRE DELTA CALCUL
private void fenetre() {
JButton confirm = new JButton("OK");
JButton cancel = new JButton("Annuler");
JTextField field2 = new JTextField(5);
JTextField field3 = new JTextField(5);
JTextField field4 = new JTextField(5);
JLabel labelDelta = new JLabel("x²");
JLabel labelDelta2 = new JLabel("x");
JLabel labelDelta3 = new JLabel("constante");
JFrame deltaFrame = new JFrame();
JPanel panelDelta = new JPanel();
deltaFrame.setLayout( new GridBagLayout());
GridBagConstraints d = new GridBagConstraints();
deltaFrame.add(panelDelta);
d.insets = new Insets(1, 1 ,1 ,1);
deltaFrame.setSize(250, 200);
deltaFrame.setLocationRelativeTo(null);
deltaFrame.setTitle("Delta");
deltaFrame.setBackground(Color.white);
deltaFrame.setVisible(true);
// PLACEMENT DES COMPOSANT FENETRE DELTA
d.gridx = 3;
d.gridy = 2;
d.gridwidth = 1;
d.gridheight = 1;
deltaFrame.add(confirm, d);
d.gridx = 4;
d.gridy = 2;
d.gridwidth = 1;
d.gridheight = 1;
deltaFrame.add(cancel, d);
d.gridx = 1;
d.gridy = 0;
d.gridwidth = 2;
d.gridheight = 1;
d.fill = GridBagConstraints.HORIZONTAL;
field2.setEditable(true);
deltaFrame.add(field2, d);
d.gridx = 2;
d.gridy = 0;
d.gridwidth = 1;
d.gridheight = 1;
deltaFrame.add(labelDelta, d);
d.gridx = 3;
d.gridy = 0;
d.gridwidth = 2;
d.gridheight = 1;
d.fill = GridBagConstraints.HORIZONTAL;
deltaFrame.add(field3, d);
d.gridx = 4;
d.gridy = 0;
d.gridwidth = 1;
d.gridheight = 1;
deltaFrame.add(labelDelta2, d);
d.gridx = 5;
d.gridy = 0;
d.gridwidth = 2;
d.gridheight = 1;
d.fill = GridBagConstraints.HORIZONTAL;
deltaFrame.add(field4, d);
d.gridx = 6;
d.gridy = 0;
d.gridwidth = 1;
d.gridheight = 1;
deltaFrame.add(labelDelta3, d);
}
} |
Partager