-
- public void units_changed(boolean imperial_units) {
- }
-
- abstract void show(AltosState state, AltosListenerState listener_state);
-
- void show(String v1, String v2) {
- show();
- value1.setText(v1);
- value2.setText(v2);
- }
-
- void show(String f1, double v1, String f2, double v2) {
- show();
- value1.setText(String.format(f1, v1));
- value2.setText(String.format(f2, v2));
- }
-
- void show(String f1, int v1, String f2, int v2) {
- show();
- value1.setText(String.format(f1, v1));
- value2.setText(String.format(f2, v2));
- }
-
- public DualValue (GridBagLayout layout, int y, String text, boolean want_lights) {
- GridBagConstraints c = new GridBagConstraints();
- c.weighty = 1;
-
- if (want_lights) {
- lights = new AltosLights();
- c.gridx = 0; c.gridy = y;
- c.anchor = GridBagConstraints.CENTER;
- c.fill = GridBagConstraints.VERTICAL;
- c.weightx = 0;
- layout.setConstraints(lights, c);
- add(lights);
- }
-
- label = new JLabel(text);
- label.setFont(AltosUILib.label_font);
- label.setHorizontalAlignment(SwingConstants.LEFT);
- c.gridx = 1; c.gridy = y;
- c.insets = new Insets(AltosUILib.tab_elt_pad, AltosUILib.tab_elt_pad, AltosUILib.tab_elt_pad, AltosUILib.tab_elt_pad);
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.VERTICAL;
- c.weightx = 0;
- layout.setConstraints(label, c);
- add(label);
-
- value1 = new JTextField(AltosUILib.text_width);
- value1.setFont(AltosUILib.value_font);
- value1.setHorizontalAlignment(SwingConstants.RIGHT);
- c.gridx = 2; c.gridy = y;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1;
- layout.setConstraints(value1, c);
- add(value1);
-
- value2 = new JTextField(AltosUILib.text_width);
- value2.setFont(AltosUILib.value_font);
- value2.setHorizontalAlignment(SwingConstants.RIGHT);
- c.gridx = 3; c.gridy = y;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1;
- c.gridwidth = 1;
- layout.setConstraints(value2, c);
- add(value2);