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 98 99
| private JPanel buildContentPane() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
nameRuleLabel = new JLabel("Nom de la règle:");
nameGroupRuleLabel = new JLabel("Nom du groupe de la règle:");
whenRuleLabel = new JLabel("Conditions:");
thenRuleLabel = new JLabel("Conséquences:");
nameRuleValue = new JTextField();
nameRuleValue.setColumns(20);
String[] columnNames = {"Condition","Valeur"};
List<Condition> conditions = new ArrayList<Condition>();
ConditionsTableModel model = new ConditionsTableModel(columnNames, conditions);
whenRuleTable = new JTable(model);
JButton boutonAdd = new JButton(new AddConditionAction(this, whenRuleTable, "+"));
JButton boutonRemove = new JButton(new RemoveConditionAction(this, whenRuleTable, "-"));
// JTable des conditions
TableUtil.initColumnSizes(whenRuleTable);
whenRuleTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
TableUtil.setUpComboBoxColumn(whenRuleTable.getColumnModel().getColumn(0));
JScrollPane scrollPaneTable = new JScrollPane(whenRuleTable);
thenRuleValue = new JTextArea();
thenRuleValue.setTransferHandler(new ToTransferHandler(TransferHandler.COPY, ruleBundle));
Object[] elements = new Object[] { "BCS", "RAP", "CV" };
nameGroupRuleValue = new JComboBox(elements);
JScrollPane scrollPane2 = new JScrollPane(thenRuleValue);
scrollPane2.setPreferredSize(new Dimension(300, 200));
JButton bouton = new JButton(new ModifyRuleAction(this, ruleBundle, "Modifier la règle"));
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(10, 10, 10, 10);
gbc.gridx = 0;
gbc.gridy = 0;
panel.add(nameRuleLabel, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
panel.add(nameRuleValue, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
panel.add(nameGroupRuleLabel, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
panel.add(nameGroupRuleValue, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
panel.add(whenRuleLabel, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
panel.add(scrollPaneTable, gbc);
gbc.insets = new Insets(10, 10, 4, 10);
gbc.gridx = 2;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.SOUTH;
panel.add(boutonAdd, gbc);
gbc.insets = new Insets(4, 10, 10, 10);
gbc.gridx = 2;
gbc.gridy = 2;
gbc.anchor = GridBagConstraints.NORTH;
panel.add(boutonRemove, gbc);
gbc.insets = new Insets(10, 10, 10, 10);
gbc.gridx = 0;
gbc.gridy = 3;
panel.add(thenRuleLabel, gbc);
gbc.gridx = 1;
gbc.gridy = 3;
panel.add(scrollPane2, gbc);
gbc.gridx = 1;
gbc.gridy = 4;
panel.add(bouton, gbc);
return panel;
} |
Partager