Newer
Older
restamp-gui / src / main / java / osm / surveyor / matchtime / gui / ParameterPanel.java
@haya4 haya4 on 7 May 2020 1 KB from ReStamp v3.1
  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. this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  33. this.setMaximumSize(new Dimension(1920, 40));
  34. this.add(argLabel);
  35. this.add(argField);
  36. }
  37. public ParameterPanel setLabel(String label) {
  38. this.argLabel.setText(label);
  39. return this;
  40. }
  41. @Override
  42. public void setText(String text) {
  43. this.argField.setText(text);
  44. }
  45. @Override
  46. public String getText() {
  47. return this.argField.getText();
  48. }
  49. }