blob: 73e93bd96b3f3ce1afcf9dbf8d906539169794ef (
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
|
package edu.wpi.first.smartdashboard.gui.elements;
import edu.wpi.first.smartdashboard.gui.elements.bindings.AbstractValueWidget;
import javax.swing.*;
import edu.wpi.first.smartdashboard.properties.*;
import edu.wpi.first.smartdashboard.types.*;
/**
* Implements a simple text box UI element with a name label.
* @author pmalmsten
*/
public class CheckBox extends AbstractValueWidget {
public static final DataType[] TYPES = {DataType.BOOLEAN};
public final BooleanProperty editable = new BooleanProperty(this, "Editable", true);
private EditableBooleanValueCheckBox valueField;
public void init() {
setResizable(false);
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
valueField = new EditableBooleanValueCheckBox(getFieldName());
add(valueField);
}
@Override
public void propertyChanged(Property property) {
if (property == editable) {
valueField.setEnabled(editable.getValue());
}
}
}
|