BreezyGUI
Class DoubleField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.TextComponent
              |
              +--java.awt.TextField
                    |
                    +--BreezyGUI.DoubleField

public class DoubleField
extends java.awt.TextField

A DoubleField is a component that allows the editing of a double (floating-point number), and allows the user to avoid messy conversions to and from strings.

See Also:
Serialized Form

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
 
Constructor Summary
DoubleField(double num)
          Creates a DoubleField containing the specified number.
 
Method Summary
 double getNumber()
          Returns the number in the DoubleField, or 0 if the data in the field do not represent a valid floating-point number.
 int getPrecision()
          Returns the precision of the number displayed in the DoubleField.
 boolean isValid()
          Returns true if the data in the DoubleField represent a floating-point number, or false otherwise.
 void setNumber(double num)
          Sets the number displayed in the DoubleField to the specified value.
 void setPrecision(int prec)
          Sets the precision of the number displayed in the DoubleField to the specified value.
 
Methods inherited from class java.awt.TextField
addActionListener, addNotify, echoCharIsSet, getColumns, getEchoChar, getMinimumSize, getMinimumSize, getPreferredSize, getPreferredSize, minimumSize, minimumSize, paramString, preferredSize, preferredSize, processActionEvent, processEvent, removeActionListener, setColumns, setEchoChar, setEchoCharacter, setText
 
Methods inherited from class java.awt.TextComponent
addTextListener, getCaretPosition, getSelectedText, getSelectionEnd, getSelectionStart, getText, isEditable, processTextEvent, removeNotify, removeTextListener, select, selectAll, setCaretPosition, setEditable, setSelectionEnd, setSelectionStart
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, 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, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, 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 num)
Creates a DoubleField containing the specified number.
Method Detail

setPrecision

public void setPrecision(int prec)
Sets the precision of the number displayed in the DoubleField to the specified value.
Parameters:
prec - the number of figures of precision (>= 0 and <= 10).

getPrecision

public int getPrecision()
Returns the precision of the number displayed in the DoubleField.

setNumber

public void setNumber(double num)
Sets the number displayed in the DoubleField to the specified value.

isValid

public boolean isValid()
Returns true if the data in the DoubleField represent a floating-point number, or false otherwise.
Overrides:
isValid in class java.awt.Component

getNumber

public double getNumber()
Returns the number in the DoubleField, or 0 if the data in the field do not represent a valid floating-point number.