1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package p3j.gui.dialogs;
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.ActionListener;
20 import java.util.ArrayList;
21 import java.util.List;
22
23 import javax.swing.JButton;
24 import javax.swing.JDialog;
25
26
27
28
29
30
31
32 public abstract class ProjectionDialog extends JDialog {
33
34
35 private static final long serialVersionUID = -4217198597804149925L;
36
37
38 protected static final int DIALOG_HEIGHT = 150;
39
40
41 protected static final int DIALOG_WIDTH = 600;
42
43
44 private final JButton okButton = new JButton("OK");
45
46
47 private final JButton cancelButton = new JButton("Cancel");
48 {
49 cancelButton.addActionListener(new ActionListener() {
50 @Override
51 public void actionPerformed(ActionEvent e) {
52 setVisible(false);
53 }
54 });
55 }
56
57 private final List<JButton> buttons = new ArrayList<JButton>();
58 {
59 getButtons().add(getOkButton());
60 getButtons().add(cancelButton);
61 }
62
63
64
65
66 public ProjectionDialog() {
67 addOKButtonAction();
68 }
69
70
71
72
73 protected abstract void addOKButtonAction();
74
75 public List<JButton> getButtons() {
76 return buttons;
77 }
78
79 public JButton getOkButton() {
80 return okButton;
81 }
82 }