public class UpDownInput extends Control implements Intable
You would usually override the changeToNext() method to cycle through the values but you can either set the textValues Vector to specify a fixed set of text values, or set the integerValues Range to specify a range of allowed integer values.
Modifier and Type | Field and Description |
---|---|
boolean |
allowNumericInput
Set this false to disallow numeric input.
|
boolean |
allowTextInput |
int |
anchor |
boolean |
autoAdvance
This is true by default and is used with the integerDigits value to allow
the focus to move to the next field when the full number of digits for this
field has been entered.
|
static int |
CHANGE_BY_KEYBOARD |
static int |
CHANGE_DONT_FLASH |
static int |
CHANGE_DOWN |
static int |
CHANGE_OPTIONS_MASK |
static int |
CHANGE_TYPE_MASK |
static int |
CHANGE_UP |
boolean |
dataChangeOnEachPress
This is false by default, and if it is set true then a DataChange event will be
sent everytime the value changes instead of only when it loses focus (which is the
default mode of operation).
|
Color |
focusedColor |
static boolean |
globalShowArrows |
boolean |
hasSplit
Show the horizontal split line.
|
int |
integerDigits
If you are using this for integer input, this specifies the number of digits
that will be input/displayed.
|
Range |
integerValues
If this is not null it will indicate a range of allowable integer values.
|
boolean |
showArrows |
Vector |
textValues
If this is not null it will indicate a set of allowable text values.
|
static int |
VALIDATE_ACTION |
static int |
VALIDATE_DATA_ENTRY |
static int |
VALIDATE_LOSING_FOCUS |
boolean |
wrapAround
This is true by default - if it is false the data will not wrap around.
|
boolean |
zeroFillInteger
If you are using this for integer input, this specifies whether zeros should
be placed in front of integer values - it is false by default.
|
boolean |
zeroIndexedText
This is false by default and if this is true then, when using the textValues Vector to list the allowable text
values, this indicates that the list of values should be zero-based indexed, otherwise
it will be 1-based index (ie 1 represents the first item, instead of 0 representing
the first item).
|
backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, curFont, debugModify, debugRepaintNow, disabledBackground, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, fontChange, fontFrom, foreGround, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, lockPaint, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, name, next, parent, penStatus, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, startDragResolution, tags, tail, text, toolTip, width, x, y
clipItems, clipObject, clipOwner, debugControl, debugFlag, doubleBuffer, doubleClickTime, doubleSizedFontHeight, firstPress, globalEditable, globalEnabled, PEN_STATUS_DID_HOLD_DOWN, PEN_STATUS_GOT_PEN_DOWN, PEN_STATUS_PEN_IS_ON, pressPoint, TAG_BOOLEAN_KEEP_BELOW_SIP, TAG_HOVER_TIME_INT, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_ABUT_ANY, BF_ABUT_BOTTOM, BF_ABUT_LEFT, BF_ABUT_RIGHT, BF_ABUT_TOP, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN
ALWAYS_STRETCHABLE, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_HIDDEN, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TAG_BACKGROUND_IMAGE, TAG_BUSY_DISPLAY, TAG_COLORS, TAG_CONTROL_PAINTER, TAG_EXPOSE_GROUP, TAG_FIXEDSIZE, TAG_GRAY_BACKGROUND, TAG_HIDE_CONTROL_OBJECT, TAG_HIDE_PARENT, TAG_INNER_TEXT_INSETS, TAG_INPUT_STACK_PARENT, TAG_INSETS, TAG_MAKE_VISIBLE, TAG_MAXIMUMSIZE, TAG_MINIMUMSIZE, TAG_PAINT_CONTROL_LIST, TAG_PREFERRED_TEXT_SIZE, TAG_PREFERRED_TEXT_SIZE_HEIGHT, TAG_PREFERRED_TEXT_SIZE_WIDTH, TAG_PREFERREDSIZE, TAG_RECT, TAG_SHADOW_INSETS, TAG_SPAN, TAG_SWIPER, TAG_TEMPORARY_ERROR, TAG_TEXT_INSETS, TAG_TEXTSIZE, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, ContainerDontPaintChildren, Disabled, DisablePopupMenu, DisplayOnly, DontBuffer, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, ModifiersInheritedFromWindow, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpUIEvents, ShowSIP, ShrinkToNothing, SmallControl, TakeChildUIEvents, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown
KEEP_VISIBLE
Constructor and Description |
---|
UpDownInput(int columns)
Create an UpDownInput that is a specific number of columns wide.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
changeToNext(int changeType)
This is called to change the value.
|
void |
changeValue(int changeType)
This is called when the user presses Up or Down but can also be called
programmatically.
|
void |
doPaint(Graphics g,
Rect area)
This is the main method to override when doing custom Control painting.
|
int |
getInt()
Return the integer value in the control - by default it simply converts the text
value to an integer.
|
void |
gotFocus(int how)
This is called when the Control gets the focus.
|
boolean |
hasChangedSinceGotFocus()
This returns true if the value represented by the Control has changed
since it got the focus.
|
void |
lostFocus(int how)
This is called when the Control loses the focus.
|
void |
numberKeyPressed(int digitValue) |
void |
onKeyEvent(KeyEvent ev) |
void |
penHeld(Point where)
Called when the Pen or Mouse button is held down on the control.
|
void |
penPressed(Point where)
Called when the Pen or Mouse button is pressed on the control.
|
void |
setInt(int value)
Return the integer value in the control - by default it simply converts the text
value to an integer.
|
void |
textKeyPressed(int character) |
protected boolean |
validateData(int how)
This is called when the control loses focus or if the action key is pressed.
|
acceptsData, activate, addListener, amOnTopFrame, applyFontChange, baseOnPenEvent, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, cache, calculatedSizes, calculateSizes, calculateTextSize, calculateTextSize, calculateTextSize, cancelHoldDown, cancelPenPress, canEdit, change, changeDimension, changeTag, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkParentInterceptsUIEvent, checkPenTransparent, childrenPainted, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createNewMenu, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deactivate, defaultTo, deferInWindowThread, doAction, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, draw, draw, draw, exitEntry, fillBackground, fillBackgroundNotInFrame, findTagInParents, fontChanged, formClosing, free, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getAncestor, getAncestor, getAncestorProperty, getBackground, getCached, getCachedChildren, getCachedDim, getCachedDim, getCachedRect, getCachedRect, getCachedSubControls, getChildAnchor, getChildren, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getContentsInsets, getContentsInsets, getContentsRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFieldTransfer, getFont, getFontMetrics, getFontMetrics, getFontMetricsForSizeCalculations, getForeground, getFrame, getFrameOrContainer, getGraphics, getGraphics, getHeight, getHideParent, getImage, getLastSelected, getLocation, getLock, getMaximumSize, getMenu, getMinimumSize, getModifiedBorderFlags, getModifiers, getNext, getNextKeyFocus, getPaintParameters, getParent, getParent, getParent, getParentOrListener, getPasswordCharacter, getPosInFrame, getPosInFrame, getPosInParent, getPosInParent, getPreferredSize, getPreferredSizeByParent, getPreferredTextSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getSubControls, getTag, getText, getToolTip, getWidth, getWindow, getWindowGraphics, hasModifier, hasPopupFormAttached, hasTag, hide, inheritModifiers, insetToContents, interceptChildUIEvent, isChildOf, isDirectChildOfWindow, isHidden, isModal, isOnMe, isOnMe, isOnMe, isSomeonesHotKey, make, makeFrameTopMost, makeHot, makeHot, makeInvisible, makeVisible, markAsTemporaryError, menuIsActive, menuStateChanged, modify, modifyAll, modifyAll, modifyFlags, mouseHover, newEventThread, notifyAction, notifyDataChange, notifyDataChange, notifyMenuItemSelected, notifyStructureChanged, onControlEvent, onEvent, onLabelPenEvent, onPenEvent, paintBackground, paintWithControlPainter, pauseEventThread, penClicked, penDoubleClicked, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, postInWindowThread, postUIEvent, putInside, queueKeyEvent, queuePenEvent, readLock, recalculatePreferredSize, redisplay, refresh, releaseBufferedGraphics, removed, removeListener, repaint, repaint, repaintDataNow, repaintInWindowThread, repaintInWindowThread, repaintNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetAllCachedProperties, resetCachedProperties, resetRect, resizeTo, restore, restoreBorderModifiers, restoreFlags, resumeEventThread, scrollAndRepaint, sendToListeners, set, setAllFonts, setBackgroundImage, setBorder, setBorderModifiers, setCell, setChildAnchor, setClipObject, setControl, setCursor, setFieldTransfer, setFixedSize, setFont, setFontChange, setFreeDragging, setHidden, setHiddenParent, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPreferredTextSize, setPreferredTextSize, setPromptControl, setRect, setRect, setScaledBackgroundImage, setServer, setShadow, setSwiping, setTag, setTags, setText, setTextSize, setTiledBackgroundImage, setToolTip, showHoldDownIndicator, shown, simulateClickOn, simulateKeyPresses, simulateKeyType, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFocus, takeFromClipboard, takePromptControl, testInWindowThread, ticked, tipIsDisplayed, toClipboard, toField, toField, toIDString, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryGetGraphics, tryNext, tryStartMenu, unhide, unlock, updateData, updateDCDuringDD, updateFrom, updateTo, verifyWantDrag, verifyWantHoldDown, waitEventThread, willAcceptDrop, willShowFrame, windowHasFloatingControls, writeLock
doubleSizeIt, getGuiTextHeight, isDoubleSized, isDoubleSizedFont, loadImage, tryLoadImage
public static boolean globalShowArrows
public boolean showArrows
public int anchor
public boolean hasSplit
public Range integerValues
public Vector textValues
public int integerDigits
public boolean zeroFillInteger
public boolean wrapAround
public boolean autoAdvance
public boolean allowNumericInput
public boolean allowTextInput
public boolean zeroIndexedText
public boolean dataChangeOnEachPress
public Color focusedColor
public static final int VALIDATE_LOSING_FOCUS
public static final int VALIDATE_ACTION
public static final int VALIDATE_DATA_ENTRY
public static final int CHANGE_UP
public static final int CHANGE_DOWN
public static final int CHANGE_TYPE_MASK
public static final int CHANGE_OPTIONS_MASK
public static final int CHANGE_BY_KEYBOARD
public static final int CHANGE_DONT_FLASH
public UpDownInput(int columns)
public boolean hasChangedSinceGotFocus()
public void gotFocus(int how)
Control
public void lostFocus(int how)
Control
protected boolean validateData(int how)
how
- one of the VALIDATE_XXX values.public void doPaint(Graphics g, Rect area)
Control
public void changeValue(int changeType)
changeType
- either CHANGE_UP or CHANGE_DOWN possibly ORed with CHANGE_BY_KEYBOARD
if the change was called by a key press.public int getInt()
public void setInt(int value)
protected boolean changeToNext(int changeType)
changeType
- either CHANGE_UP or CHANGE_DOWNpublic void textKeyPressed(int character)
public void numberKeyPressed(int digitValue)
public void onKeyEvent(KeyEvent ev)
onKeyEvent
in class Control
public void penPressed(Point where)
Control
Within this method you can use the Control.Gui.currentPenPress() value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
penPressed
in class Control
where
- The point on the Control where the pen was pressed.public void penHeld(Point where)
Control
Within this method you can use the Control.Gui.currentPenPress() value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
This method is usually used to display a context sensitive menu. In fact the default code for it is:
if (!menuIsActive()) doMenu(p);