-
- public LandedValue (GridBagLayout layout, int y, AltosUnits units, String text) {
- this.units = units;
-
- GridBagConstraints c = new GridBagConstraints();
- c.weighty = 1;
-
- label = new JLabel(text);
- label.setFont(Altos.label_font);
- label.setHorizontalAlignment(SwingConstants.LEFT);
- c.gridx = 0; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
- c.anchor = GridBagConstraints.WEST;
- c.weightx = 0;
- c.fill = GridBagConstraints.VERTICAL;
- layout.setConstraints(label, c);
- add(label);
-
- value = new JTextField(Altos.text_width);
- value.setFont(Altos.value_font);
- value.setHorizontalAlignment(SwingConstants.RIGHT);
- c.gridx = 1; c.gridy = y;
- c.anchor = GridBagConstraints.WEST;
- c.weightx = 1;
- c.fill = GridBagConstraints.BOTH;
- layout.setConstraints(value, c);
- add(value);
- }
-
- public LandedValue (GridBagLayout layout, int y, String text) {
- this(layout, y, null, text);
- }
- }
-
- String pos(double p, String pos, String neg) {
- String h = pos;
- if (p < 0) {
- h = neg;
- p = -p;
- }
- int deg = (int) Math.floor(p);
- double min = (p - Math.floor(p)) * 60.0;
- return String.format("%s %4d° %9.6f", h, deg, min);