Class LatLonEditor

All Implemented Interfaces:
FocusListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, AncestorListener, ChangeListener

public class LatLonEditor extends JPanel implements ChangeListener, PropertyChangeListener, FocusListener, AncestorListener
Provide a displayer/editor for a latitude or longitude value. The units that can be displayed and edited with this are set by the LatLonFormatter class's global;LatLonFormat property, and include:
  • in degrees/minutes/fractional minutes and direction
  • in degrees/minutes/seconds and direction
  • in fractional signed degrees
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Details

    • LatLonEditor

      public LatLonEditor(boolean isLat, String value)
      Construct this editor in the current format, parsing the String value in the APRS-standard DDMM.MM format.
      Parameters:
      isLat - boolean true if this should be ranged to edit latitudes, false for longitudes
      value - String value to initialize the editor to, in APRS-standard ASCII format
    • LatLonEditor

      public LatLonEditor(boolean isLat, double value)
      Construct this editor in the current format, initializing to the provided value in fractional degrees.
      Parameters:
      isLat - boolean true if this should be ranged to edit latitudes, false for longitudes
      value - double value in fractional degrees North or East (as appropriate)
  • Method Details

    • setValue

      public void setValue(String value)
      Set the current value to be displayed in this editor.
      Parameters:
      value - String latitude or longitude, expected to be compliant with the current format of the editor
      See Also:
    • setValue

      public void setValue(double value)
      Set the current value in this editor from a floating-point value
      Parameters:
      value - double latitude or longitude in fractional degrees North or East
    • getStringValue

      public String getStringValue()
      Get the current value of this editor in the currently configured string format.
      Returns:
      formatted String of the editor's latitude or longitude value
      See Also:
    • getDoubleValue

      public double getDoubleValue()
      Get the current value of this editor in fractional degrees North or East.
      Returns:
      double fractional degrees value
    • setEnabled

      public void setEnabled(boolean enabled)
      Specify whether or not this editor's value may be modified by a user.
      Overrides:
      setEnabled in class JComponent
      Parameters:
      enabled - boolean true if editor's value may be changed
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Register a ChangeListener to be informed of alterations in this editor's value.
      Parameters:
      l - ChangeListener to register
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Unregister a ChangeListener so it is no longer informed of changes within this editor.
      Parameters:
      l - ChangeListener to unregister
    • stateChanged

      public final void stateChanged(ChangeEvent e)
      Do not call. Internal editor field listener to monitor changes to the individual sub-widgets of this editor.
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - ChangeEvent identifying the specific sub-widget that was changed
    • focusGained

      public void focusGained(FocusEvent e)
      Do not call. Internal editor field listener to configure sub-widgets based on user actions.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      e - FocusEvent identifying the modified sub-widget
    • focusLost

      public void focusLost(FocusEvent e)
      Do not call. Internal editor field listener to configure sub-widgets based on user actions.
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      e - FocusEvent identifying the modified sub-widget
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      This method gets called when a bound property is changed.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      evt - A PropertyChangeEvent object describing the event source and the property that has changed.
    • ancestorAdded

      public void ancestorAdded(AncestorEvent event)
      Called when the source or one of its ancestors is made visible either by setVisible(true) being called or by its being added to the component hierarchy. The method is only called if the source has actually become visible. For this to be true all its parents must be visible and it must be in a hierarchy rooted at a Window
      Specified by:
      ancestorAdded in interface AncestorListener
    • ancestorRemoved

      public void ancestorRemoved(AncestorEvent event)
      Called when the source or one of its ancestors is made invisible either by setVisible(false) being called or by its being remove from the component hierarchy. The method is only called if the source has actually become invisible. For this to be true at least one of its parents must by invisible or it is not in a hierarchy rooted at a Window
      Specified by:
      ancestorRemoved in interface AncestorListener
    • ancestorMoved

      public void ancestorMoved(AncestorEvent event)
      Called when either the source or one of its ancestors is moved.
      Specified by:
      ancestorMoved in interface AncestorListener