blob: c15381e6974ba514b0a828e29e0be3101585ebcb (
plain)
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
|
package UI.Components;
import javax.swing.*;
import java.awt.*;
public class InputBox extends JPanel {
JLabel label;
JTextField textField;
public InputBox(String label) {
this.label = new JLabel(label);
this.label.setPreferredSize(new Dimension(70, 30));
this.add(this.label);
this.add(Box.createHorizontalGlue());
this.textField = new JTextField(20);
this.add(this.textField);
this.setLayout(new FlowLayout(FlowLayout.CENTER));
}
public String getLabel() {
return this.label.getText();
}
public String getValue() {
return this.textField.getText();
}
public void setLabel(String label) {
this.label.setText(label);
}
public void setValue(String value) {
this.textField.setText(value);
this.textField.repaint();
}
}
|