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
| String[] myActions = {"Une action", "Une autre action", "Une dernière action"};
JList list = new JList(myActions);
JLabel all = new JLabel("Toutes mes actions :");
JLabel date2 = new JLabel("Date :");
JLabel parts2 = new JLabel("Nombre de parts :");
JLabel prix2 = new JLabel("Prix de l'action :");
TextField wDate2 = new TextField();
TextField wParts2 = new TextField();
TextField wPrix2 = new TextField();
JButton ajouter2 = new JButton("Ajouter");
JButton detail = new JButton("Voir le détail de cette action");
//GBC pour le JLabel all
gbc.gridx = gbc.gridy = 0;
gbc.anchor = GridBagConstraints.LINE_START;
gbc.insets = new Insets(10, 15, 0, 0);
actions.add(all, gbc);
//GBC pour la JList list
gbc.gridy = 1;
gbc.gridheight = 5;
gbc.fill = GridBagConstraints.BOTH;
actions.add(list, gbc);
//GBC pour le JLabel date2
gbc.gridx = 1;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
actions.add(date2, gbc);
//GBC pour le TexteField wDate
gbc.gridx = 2;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.fill = GridBagConstraints.HORIZONTAL;
actions.add(wDate2, gbc);
//GBC pour le JLabel parts2
gbc.gridx = 1;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
actions.add(parts2, gbc);
//GBC pour le TexteField wParts2
gbc.gridx = 2;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.fill = GridBagConstraints.HORIZONTAL;
actions.add(wParts2, gbc);
//GBC pour le JLabel prix2
gbc.gridx = 1;
gbc.gridy = 3;
gbc.fill = GridBagConstraints.NONE;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
actions.add(prix2, gbc);
//GBC pour le TexteField wPrix2
gbc.gridx = 2;
gbc.anchor = GridBagConstraints.BASELINE;
gbc.fill = GridBagConstraints.HORIZONTAL;
actions.add(wPrix2, gbc);
//GBC pour le JButton ajouter2
gbc.gridy = 4;
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.NONE;
actions.add(ajouter2, gbc);
//GBC pour le JButton detail
gbc.gridx = 1;
gbc.gridy = 5;
actions.add(detail, gbc);
onglets.addTab("Mes actions", actions);
frm.add(onglets);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setSize(600, 400);
frm.setVisible(true); |
Partager