OSDN Git Service

MAVEN構成
[importpicture/importpicture.git] / src / main / java / osm / jp / gpx / matchtime / gui / ParameterPanel.java
1 package osm.jp.gpx.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     @SuppressWarnings("OverridableMethodCallInConstructor")
22     public ParameterPanel(String label, String text) {
23         this();
24         this.argLabel.setText(label);
25         this.argField.setText(text);
26     }
27
28     public ParameterPanel() {
29         super();
30
31         argLabel = new JLabel();
32         argField = new JTextField();
33                 
34         this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
35         this.setMaximumSize(new Dimension(1920, 40));
36         this.add(argLabel);
37         this.add(argField);
38     }
39     
40     public ParameterPanel setLabel(String label) {
41         this.argLabel.setText(label);
42         return this;
43     }
44     
45     @Override
46     public void setText(String text) {
47         this.argField.setText(text);
48     }
49     
50     @Override
51     public String getText() {
52         return this.argField.getText();
53     }
54 }