rvl.awt
Class DoubleField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.TextComponent
              |
              +--java.awt.TextField
                    |
                    +--rvl.awt.DoubleField
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DoubleField
extends java.awt.TextField
implements java.awt.event.FocusListener

GUI component for I/O of double-precision numbers. Also generates an event if RETURN is pressed or focus is lost after value has changed

See Also:
Serialized Form

Inner classes inherited from class java.awt.TextField
java.awt.TextField.AccessibleAWTTextField
 
Inner classes inherited from class java.awt.TextComponent
java.awt.TextComponent.AccessibleAWTTextComponent
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class java.awt.TextComponent
textListener
 
Fields inherited from class java.awt.Component
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
DoubleField(double x)
           
DoubleField(double x, int width)
          Double field with the default of 3 digits
DoubleField(double x, int width, int dig)
           
DoubleField(java.lang.String msg, int width)
          Initialize like a Textfield (initial value is Double.NaN)
 
Method Summary
 void focusGained(java.awt.event.FocusEvent e)
          Handle focus events (1.1 model)
 void focusLost(java.awt.event.FocusEvent e)
           
 double getValue()
           
 boolean gotFocus(java.awt.Event e, java.lang.Object o)
          Interpret focus events (1.0 model)
 boolean keyDown(java.awt.Event evt, int key)
          Look for RETURN key to create an event, else pass on to superclass
 boolean lostFocus(java.awt.Event e, java.lang.Object o)
           
 void setValue(double x)
           
 
Methods inherited from class java.awt.TextField
addActionListener, addNotify, echoCharIsSet, getAccessibleContext, getColumns, getEchoChar, getListeners, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, minimumSize, minimumSize, paramString, preferredSize, preferredSize, processActionEvent, processEvent, removeActionListener, setColumns, setEchoChar, setEchoCharacter, setText
 
Methods inherited from class java.awt.TextComponent
addTextListener, getBackground, getCaretPosition, getSelectedText, getSelectionEnd, getSelectionStart, getText, isEditable, processTextEvent, removeNotify, removeTextListener, select, selectAll, setBackground, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyUp, layout, list, list, list, list, list, locate, location, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleField

public DoubleField(double x)
Parameters:
x - initial value

DoubleField

public DoubleField(double x,
                   int width)
Double field with the default of 3 digits
Parameters:
x - initial value
width - width of field (approx # characters)

DoubleField

public DoubleField(double x,
                   int width,
                   int dig)
Parameters:
x - initial value
width - width of field (approx # characters)
dig - number of digits (allow 7 spaces in width for exponents and signs)

DoubleField

public DoubleField(java.lang.String msg,
                   int width)
Initialize like a Textfield (initial value is Double.NaN)
Parameters:
width - width of field (approx # characters)
Method Detail

setValue

public void setValue(double x)
Parameters:
x - new value to put in window

getValue

public double getValue()
Returns:
current value in window (or NaN if invalid)

keyDown

public boolean keyDown(java.awt.Event evt,
                       int key)
Look for RETURN key to create an event, else pass on to superclass
Overrides:
keyDown in class java.awt.Component

gotFocus

public boolean gotFocus(java.awt.Event e,
                        java.lang.Object o)
Interpret focus events (1.0 model)
Overrides:
gotFocus in class java.awt.Component

lostFocus

public boolean lostFocus(java.awt.Event e,
                         java.lang.Object o)
Overrides:
lostFocus in class java.awt.Component

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Handle focus events (1.1 model)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener