planetj.gui
Class CMNumberField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
                          |
                          +--javax.swing.JTextField
                                |
                                +--planetj.gui.CMTextFieldJ
                                      |
                                      +--planetj.gui.CMNumberField
All Implemented Interfaces:
Accessible, EventListener, FocusListener, ImageObserver, MenuContainer, Scrollable, Serializable, SwingConstants

public class CMNumberField
extends CMTextFieldJ
implements FocusListener

A text field that only allows numeric characters.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CMNumberField()
          Constructor
CMNumberField(Document arg1, String arg2, int arg3)
          CMUpperCaseField constructor comment.
CMNumberField(int cols)
           
CMNumberField(String arg1)
          CMUpperCaseField constructor comment.
CMNumberField(String arg1, int arg2)
          CMUpperCaseField constructor comment.
 
Method Summary
 void focusGained(FocusEvent e)
          Method to handle events for the FocusListener interface.
 void focusLost(FocusEvent e)
          Method to handle events for the FocusListener interface.
 boolean getAutoShowException()
           
 boolean getDecimalsUsed()
          getDecimalsUsed() will return if the decimals are used for this number field
 int getMaxValueSize()
          Gets the maximum allowed value for this input field
 int getMinValueSize()
          Gets the minimum allowed value for this input field
 int getValue()
          Returns the value of the text as an int
static void main(String[] args)
          main entrypoint - starts the part when it is run as an application
 void setAutoShowException(boolean ase)
           
 void setDecimalsUsed(boolean bol)
          setDecimalsUsed() will set the decimals used boolean
 void setMaxValueSize(int mv)
          Sets the maximum value allowed in this input field
 void setMinValueSize(int mv)
          Sets the minimum value allowed in this input field
 void validateInput()
          validate this field is within limits
 
Methods inherited from class planetj.gui.CMTextFieldJ
addPropertyChangeListener, clearText, firePropertyChange, getApplicable, getEditable, getEnabled, getText, getTranslation, getTranslationId, grabFocusGained, grabFocusLost, isAutomaticallyTrimContents, isBlank, isSelectAllTextOnFocusGained, removePropertyChangeListener, setApplicable, setAutomaticallyTrimContents, setEditable, setEnabled, setSelectAllTextOnFocusGained, setText, setToolTipText, setTranslation
 
Methods inherited from class javax.swing.JTextField
addActionListener, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMNumberField

public CMNumberField()
Constructor


CMNumberField

public CMNumberField(int cols)

CMNumberField

public CMNumberField(String arg1)
CMUpperCaseField constructor comment.

Parameters:
arg1 - java.lang.String

CMNumberField

public CMNumberField(String arg1,
                     int arg2)
CMUpperCaseField constructor comment.

Parameters:
arg1 - java.lang.String
arg2 - int

CMNumberField

public CMNumberField(Document arg1,
                     String arg2,
                     int arg3)
CMUpperCaseField constructor comment.

Parameters:
arg1 - javax.swing.text.Document
arg2 - java.lang.String
arg3 - int
Method Detail

focusGained

public void focusGained(FocusEvent e)
Method to handle events for the FocusListener interface.

Specified by:
focusGained in interface FocusListener
Overrides:
focusGained in class CMTextFieldJ
Parameters:
e - java.awt.event.FocusEvent

focusLost

public void focusLost(FocusEvent e)
Method to handle events for the FocusListener interface.

Specified by:
focusLost in interface FocusListener
Overrides:
focusLost in class CMTextFieldJ
Parameters:
e - java.awt.event.FocusEvent

getAutoShowException

public boolean getAutoShowException()

getDecimalsUsed

public boolean getDecimalsUsed()
getDecimalsUsed() will return if the decimals are used for this number field

Returns:
booean

getMaxValueSize

public int getMaxValueSize()
Gets the maximum allowed value for this input field


getMinValueSize

public int getMinValueSize()
Gets the minimum allowed value for this input field


getValue

public int getValue()
Returns the value of the text as an int


main

public static void main(String[] args)
main entrypoint - starts the part when it is run as an application

Parameters:
args - java.lang.String[]

setAutoShowException

public void setAutoShowException(boolean ase)

setDecimalsUsed

public void setDecimalsUsed(boolean bol)
setDecimalsUsed() will set the decimals used boolean


setMaxValueSize

public void setMaxValueSize(int mv)
Sets the maximum value allowed in this input field


setMinValueSize

public void setMinValueSize(int mv)
Sets the minimum value allowed in this input field


validateInput

public void validateInput()
validate this field is within limits