diff options
| author | bjculkin <bjculkin@BECK-DZ9BJB2.wvu-ad.wvu.edu> | 2018-04-11 15:29:25 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@BECK-DZ9BJB2.wvu-ad.wvu.edu> | 2018-04-11 15:29:25 -0400 |
| commit | dcb6c2159446135a142cad41eec185bb24c45bfb (patch) | |
| tree | 965dcc07fc0256a9a8254d5f968e316a1e928617 /CSMath/src/bezier/LabeledInputPanel.java | |
| parent | 8ecf52b6c5821e5c3de8a0f5c9e7ed3e357cb282 (diff) | |
Split #9 into one class/file
Diffstat (limited to 'CSMath/src/bezier/LabeledInputPanel.java')
| -rw-r--r-- | CSMath/src/bezier/LabeledInputPanel.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/CSMath/src/bezier/LabeledInputPanel.java b/CSMath/src/bezier/LabeledInputPanel.java new file mode 100644 index 0000000..0f97a0f --- /dev/null +++ b/CSMath/src/bezier/LabeledInputPanel.java @@ -0,0 +1,42 @@ +package bezier;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+/**
+ * A component for getting formatted input with a label.
+ *
+ * @author bjculkin
+ *
+ */
+public class LabeledInputPanel extends JPanel {
+ private static final long serialVersionUID = 1031310890698539040L;
+
+ /**
+ * The field input is stored in.
+ */
+ public final JFormattedTextField field;
+
+ /**
+ * Create a new labeled input component.
+ *
+ * @param label
+ * The label for the component.
+ * @param val
+ * The initial value for the field.
+ */
+ public LabeledInputPanel(String label, Object val) {
+ super();
+ setLayout(new BorderLayout());
+
+ JLabel xLabel = new JLabel(label);
+
+ field = new JFormattedTextField(val);
+
+ add(xLabel, BorderLayout.LINE_START);
+ add(field, BorderLayout.CENTER);
+ }
+}
\ No newline at end of file |
