1 | final int index = i;↵ | | 1 | final int index = i;↵
|
2 | removeButton.addActionListener(new ActionListener() {↵ | | 2 | removeButton.addActionListener(new ActionListener() {↵
|
3 | public void actionPerformed(ActionEvent e) {↵ | | 3 | public void actionPerformed(ActionEvent e) {↵
|
4 | remove(index);↵ | | 4 | remove(index);↵
|
5 | }↵ | | 5 | }↵
|
6 | });↵ | | 6 | });↵
|
|
7 | /*↵ | | |
|
8 | * c.gridx = GridBagConstraints.REMAINDER; c.anchor =↵ | | |
|
9 | * GridBagConstraints.NORTHEAST; gridbag.setConstraints(↵ | | |
|
10 | * removeButton, c ); panel.add( removeButton );↵ | | |
|
11 | */↵ | | |
|
12 | JPanel buttonPanel = new JPanel();↵ | | 7 | JPanel buttonPanel = new JPanel();↵
|
13 | buttonPanel.setLayout(new GridLayout(0, 2, 2, 2));↵ | | 8 | buttonPanel.setLayout(new GridLayout(0, 2, 2, 2));↵
|
14 | buttonPanel.add(removeButton);↵ | | 9 | buttonPanel.add(removeButton);↵
|
15 | buttonPanel.add(addButton);↵ | | 10 | buttonPanel.add(addButton);↵
|
|
16 | c.insets = new Insets(2, 2, 2, 2);↵ | | 11 | c.insets = new Insets(2, 2, 2, 2);↵
|
17 | c.gridx = GridBagConstraints.REMAINDER;↵ | | 12 | c.gridx = GridBagConstraints.REMAINDER;↵
|
18 | c.anchor = GridBagConstraints.NORTHEAST;↵ | | 13 | c.anchor = GridBagConstraints.NORTHEAST;↵
|
19 | gridbag.setConstraints(buttonPanel, c);↵ | | 14 | gridbag.setConstraints(buttonPanel, c);↵
|
20 | panel.add(buttonPanel); | | 15 | panel.add(buttonPanel);
|