Class LatLongEditorDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class LatLongEditorDialog extends JDialog
A modal dialog that allows the user to view and edit a geographic coordinate in either Decimal Degrees or UTM format.

Internally, the coordinate is stored as a Point2D.Double in radians, following the mapping convention: .x = longitude, .y = latitude.

The two edit panels are kept in sync on every mode switch: before revealing the incoming panel, the dialog first commits any edits from the outgoing panel into currentPoint, then re-populates the incoming panel from that updated value. This means the user's in-progress edits are never silently discarded.

Usage:


 LatLongEditorDialog dlg = new LatLongEditorDialog(ownerFrame, point);
 dlg.setVisible(true);
 Point2D.Double result = dlg.getResult(); // null if the user cancelled
 
See Also:
  • Constructor Details

    • LatLongEditorDialog

      public LatLongEditorDialog(Frame owner, Point2D.Double initialPoint)
      Creates a new coordinate editor dialog.
      Parameters:
      owner - the parent frame (may be null)
      initialPoint - the starting coordinate in radians (.x = longitude, .y = latitude); a defensive copy is taken immediately
  • Method Details

    • getResult

      public Point2D.Double getResult()
      Returns the edited coordinate in radians (.x = longitude, .y = latitude), or null if the user cancelled without saving.

      A defensive copy is returned so the caller cannot modify the dialog's internal state after the fact.

      Returns:
      the result coordinate, or null on cancel