+ public abstract class DescentDualValue {
+ JLabel label;
+ JTextField value1;
+ JTextField value2;
+
+ void reset() {
+ value1.setText("");
+ value2.setText("");
+ }
+
+ abstract void show(AltosState state, int crc_errors);
+ void show(String v1, String v2) {
+ value1.setText(v1);
+ value2.setText(v2);
+ }
+ void show(String f1, double v1, String f2, double v2) {
+ value1.setText(String.format(f1, v1));
+ value2.setText(String.format(f2, v2));
+ }
+
+ public DescentDualValue (GridBagLayout layout, int x, int y, String text) {
+ GridBagConstraints c = new GridBagConstraints();
+ c.weighty = 1;
+
+ label = new JLabel(text);
+ label.setFont(Altos.label_font);
+ label.setHorizontalAlignment(SwingConstants.LEFT);
+ c.gridx = x + 1; c.gridy = y;
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.VERTICAL;
+ c.weightx = 0;
+ layout.setConstraints(label, c);
+ add(label);
+
+ value1 = new JTextField(17);
+ value1.setFont(Altos.value_font);
+ value1.setHorizontalAlignment(SwingConstants.RIGHT);
+ c.gridx = x + 2; c.gridy = y;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ layout.setConstraints(value1, c);
+ add(value1);
+
+ value2 = new JTextField(17);
+ value2.setFont(Altos.value_font);
+ value2.setHorizontalAlignment(SwingConstants.RIGHT);
+ c.gridx = x + 3; c.gridy = y;
+ c.anchor = GridBagConstraints.WEST;
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ layout.setConstraints(value2, c);
+ add(value2);
+ }
+ }
+
+ class Height extends DescentDualValue {