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
|
package prefs.editors;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.filechooser.*;
import java.util.*;
import java.io.File;
import prefs.*;
import simulator.*;
import utils.*;
public abstract class VSBetterEditor extends VSEditor {
private Container contentPane;
protected VSInfoArea infoArea;
private String title;
public VSBetterEditor(VSPrefs prefs, VSPrefs prefsToEdit, String title) {
super(prefs, prefsToEdit);
this.title = title;
this.contentPane = createContentPane();
}
public VSBetterEditor(VSPrefs prefs, VSPrefs prefsToEdit, String title, int prefsCategory) {
super(prefs, prefsToEdit, prefsCategory);
this.title = title;
this.contentPane = createContentPane();
}
public String getTitle() {
return title;
}
public Container getContentPane() {
return contentPane;
}
private JPanel createContentPane() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
infoArea = new VSInfoArea();
JPanel editPanel = super.editPanel;
JPanel buttonPanel = createButtonPanel();
JScrollPane scrollPane = new JScrollPane(editPanel);
panel.add(infoArea, BorderLayout.NORTH);
panel.add(scrollPane, BorderLayout.CENTER);
panel.add(buttonPanel, BorderLayout.SOUTH);
return panel;
}
protected void addToEditPanelFront(JPanel editPanel) { }
protected void addToEditPanelLast(JPanel editPanel) { }
private JPanel createButtonPanel() {
JPanel buttonPanel = super.buttonPanel;
JButton cancelButton = new JButton(
prefs.getString("lang.cancel"));
cancelButton.setMnemonic(prefs.getInteger("keyevent.cancel"));
cancelButton.addActionListener(this);
buttonPanel.add(cancelButton);
return buttonPanel;
}
public void actionPerformed(ActionEvent e) {
//String actionCommand = e.getActionCommand();
/* More action in the super class!!! */
super.actionPerformed(e);
}
public void newVSEditorInstance(VSPrefs prefs, VSPrefs prefsToEdit, int prefsCategory) { };
}
|