- void show() {
- value.setVisible(true);
- lights.setVisible(true);
- label.setVisible(true);
- }
-
- void hide() {
- value.setVisible(false);
- lights.setVisible(false);
- label.setVisible(false);
- }
-
- abstract void show(AltosState state, AltosListenerState listener_state);
-
- void show(String s) {
- show();
- value.setText(s);
- }
-
- void show(double v) {
- this.v = v;
- show(units.show(8, v));
- }
-
- void show(String format, double v) {
- show(String.format(format, v));
- }
-
- void show(String format, int v) {
- show(String.format(format, v));
- }
-
- void reset() {
- lights.set(false);
- value.setText("");
- }
-
- public void font_size_changed(int font_size) {
- label.setFont(AltosUILib.label_font);
- value.setFont(AltosUILib.value_font);
- }
-
- public void units_changed(boolean imperial_units) {
- if (units != null)
- show(v);
- }
-
- public Info (GridBagLayout layout, int y, AltosUnits units, String text) {
- this.units = units;
-
- GridBagConstraints c = new GridBagConstraints();
- c.weighty = 1;
-
- 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);
-
- value = new JTextField(AltosUILib.text_width);
- value.setFont(AltosUILib.value_font);
- value.setHorizontalAlignment(SwingConstants.RIGHT);
- c.gridx = 2; c.gridy = y;
- c.gridwidth = 2;
- c.anchor = GridBagConstraints.WEST;
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1;
- layout.setConstraints(value, c);
- add(value);
- }
-
- public Info (GridBagLayout layout, int y, String text) {
- this(layout, y, null, text);