OSDN Git Service

maven
[restamp/Restamp-gui.git] / src / main / java / osm / surveyor / matchtime / gui / ParameterPanel.java
1 package osm.surveyor.matchtime.gui;
2
3 import java.awt.Dimension;
4 import java.util.ResourceBundle;
5
6 import javax.swing.BoxLayout;
7 import javax.swing.JLabel;
8 import javax.swing.JPanel;
9 import javax.swing.JTextField;
10
11 /**
12  * パラメータを設定する為のパネル。
13  * この1インスタンスで、1パラメータをあらわす。
14  */
15 public abstract class ParameterPanel extends JPanel implements ParamAction {
16     private static final long serialVersionUID = 4629824800747170556L;
17     public JTextField argField;
18     public JLabel argLabel;
19     public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
20
21     public ParameterPanel(String label, String text) {
22         this();
23         this.argLabel.setText(label);
24         this.argField.setText(text);
25     }
26
27     public ParameterPanel() {
28         super();
29
30         argLabel = new JLabel();
31         argField = new JTextField();
32                 
33         this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
34         this.setMaximumSize(new Dimension(1920, 40));
35         this.add(argLabel);
36         this.add(argField);
37     }
38     
39     public ParameterPanel setLabel(String label) {
40         this.argLabel.setText(label);
41         return this;
42     }
43     
44     @Override
45     public void setText(String text) {
46         this.argField.setText(text);
47     }
48     
49     @Override
50     public String getText() {
51         return this.argField.getText();
52     }
53 }