Package org.ka2ddo.yaac.gui
Class LatLonEditor
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.ka2ddo.yaac.gui.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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionLatLonEditor
(boolean isLat, double value) Construct this editor in the current format, initializing to the provided value in fractional degrees.LatLonEditor
(boolean isLat, String value) Construct this editor in the current format, parsing the String value in the APRS-standard DDMM.MM format. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a ChangeListener to be informed of alterations in this editor's value.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.void
ancestorMoved
(AncestorEvent event) Called when either the source or one of its ancestors is moved.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.void
Do not call.void
Do not call.double
Get the current value of this editor in fractional degrees North or East.Get the current value of this editor in the currently configured string format.void
This method gets called when a bound property is changed.void
Unregister a ChangeListener so it is no longer informed of changes within this editor.void
setEnabled
(boolean enabled) Specify whether or not this editor's value may be modified by a user.void
setValue
(double value) Set the current value in this editor from a floating-point valuevoid
Set the current value to be displayed in this editor.final void
Do not call.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
LatLonEditor
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 longitudesvalue
- 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 longitudesvalue
- double value in fractional degrees North or East (as appropriate)
-
-
Method Details
-
setValue
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
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 classJComponent
- Parameters:
enabled
- boolean true if editor's value may be changed
-
addChangeListener
Register a ChangeListener to be informed of alterations in this editor's value.- Parameters:
l
- ChangeListener to register
-
removeChangeListener
Unregister a ChangeListener so it is no longer informed of changes within this editor.- Parameters:
l
- ChangeListener to unregister
-
stateChanged
Do not call. Internal editor field listener to monitor changes to the individual sub-widgets of this editor.- Specified by:
stateChanged
in interfaceChangeListener
- Parameters:
e
- ChangeEvent identifying the specific sub-widget that was changed
-
focusGained
Do not call. Internal editor field listener to configure sub-widgets based on user actions.- Specified by:
focusGained
in interfaceFocusListener
- Parameters:
e
- FocusEvent identifying the modified sub-widget
-
focusLost
Do not call. Internal editor field listener to configure sub-widgets based on user actions.- Specified by:
focusLost
in interfaceFocusListener
- Parameters:
e
- FocusEvent identifying the modified sub-widget
-
propertyChange
This method gets called when a bound property is changed.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
evt
- A PropertyChangeEvent object describing the event source and the property that has changed.
-
ancestorAdded
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 interfaceAncestorListener
-
ancestorRemoved
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 interfaceAncestorListener
-
ancestorMoved
Called when either the source or one of its ancestors is moved.- Specified by:
ancestorMoved
in interfaceAncestorListener
-