OSDN Git Service

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