public class Input extends EditControl implements Selectable
Call getText() and setText() to get/set the text data.
Set isPassword true to indicate that '*' characters should be displayed instead of the input text.
Change the columns value to increase the preferred width of the input. This value is measured in characters.
Modifier and Type | Class and Description |
---|---|
static interface |
Input.ExtraTool |
Modifier and Type | Field and Description |
---|---|
int |
clicksToFireAction
You can have the mInput fire an action event when the user single clicks the mInput by setting
this value to 1, or double clicks by setting the value to 2.
|
protected boolean |
cursorOn |
protected int |
cursorPos |
static int |
DATA_CHANGED_BY_ENTER
This is a flag used with a generated DataChangeEvent to indicate that the data was changed by the
enter key being pressed.
|
boolean |
dataChangeOnEachKey
If this is true then a DataChange will be fired on each key.
|
static int |
DefaultSpacing |
protected int |
endSel |
Vector |
extraTools |
protected boolean |
hasCursor |
static String |
hidden
This String will be used to display characters when the isPassword option is used.
|
boolean |
isPassword
Set this true so that only '*' characters are displayed.
|
protected int |
leftMost |
int |
maxLength
This is the maximum number of allowed characters, a value of -1 (the default) puts no limit
on the number of characters.
|
int |
minXScroll
A percent figure.
|
boolean |
noFocusHighlight
Set this true to not draw the in-focus highlight.
|
protected int |
numDisplayed |
char |
passwordCharacter
This is the password character to use for the input.
|
int |
spacing |
protected int |
startSel |
boolean |
wantReturn
If this is true then the mInput will fire an action event when enter is pressed, but will not
automatically pass focus to the next control as it would usually do.
|
actAsLabel, blinkId, CASE_LOWER, CASE_NORMAL, CASE_NUMBERS, CASE_SENTENCE, CASE_UPPER, colors, conditionalChar, conditionalCharIndex, defaultInputFlags, doingLocalInput, doingNativeInput, FLAG_INPUT_ON_FOCUS, FLAG_KEEP_FOCUS_AFTER_INPUT, FLAG_NEED_FULL_ACTION, FLAG_PASSIVE, FLAG_USE_NATIVE, inFocus, inputFlags, inputMethod, justGotFocus, nothingEnteredText, oldText, pageColor, startNativeOnPaint, textCase, validator
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
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsData(Object data,
DragContext how)
This should indicate whether this control will accept the data either via
a drag and drop or via a paste operation.
|
Input |
addExtraTool(Input.ExtraTool tool) |
static void |
calculatePreferredSize(Control c,
int columns,
int spacing) |
static void |
calculatePreferredSize(FontMetrics fm,
int columns,
int spacing,
Dimension dim) |
protected void |
calculateSizes()
Override this to calculate the preferred, minimum and maximum size of your control.
|
void |
clearCursor()
Clear the cursor.
|
void |
cursorToEnd() |
boolean |
deleteSelection() |
protected void |
doDragAt(Point p) |
void |
doPaint(Graphics g,
Rect area)
This is the main method to override when doing custom Control painting.
|
protected void |
doPaintData(Graphics gr)
Repaint the "data" part of the Control.
|
protected boolean |
doShowMenu(Point p)
Used to show the menu associated with the Control.
|
void |
dragged(DragContext dc)
This is called during the drag operation.
|
protected void |
enterOrEscapePressed(boolean isEnter) |
int |
execute(Control parent,
int x,
int y,
int width,
int height,
int options)
Input text embedded within another Control using this Input.
|
static String |
execute(String originalText,
Control parent,
int x,
int y,
int width,
int height,
int options)
Input text embedded within another Control using a new Input.
|
int |
findPressedChar(Point where) |
protected boolean |
fix() |
protected boolean |
getCharRect(int which,
Rect dest) |
int |
getCursorPosition() |
protected Rect |
getDataRect(Rect dest) |
String |
getDisplay(String s)
This gets the String to represent on screen the data String provided.
|
char |
getPasswordCharacter()
If isPassword is false, this returns 0, otherwise it will return the password character
to use for display.
|
Object |
getSelection() |
Range |
getSelectionRange()
Use this to get the selection range.
|
protected int |
getTextAreaWidth() |
protected int |
getWidthForExtraTools() |
void |
gotFocus(int how)
This is called when the Control gets the focus.
|
boolean |
hasSelection() |
Input |
initializeData(String text)
This sets the text and the oldText so that a DataChange is not generated when the Input first gets focus.
|
void |
lostFocus(int how)
This is called when the Control loses the focus.
|
protected void |
moveCursorPos(int where,
boolean takeSelection) |
protected void |
newCursorPos(int where) |
protected void |
newCursorPos(int where,
boolean takeSelection) |
void |
newText(String what,
int newCursorPos) |
void |
newText(String what,
int newCursorPos,
boolean repaintAll) |
boolean |
noSelection() |
void |
onEvent(Event ev) |
void |
onKeyEvent(KeyEvent ev) |
boolean |
paintConditionalChar(Graphics gr,
boolean underlined) |
void |
paintCursor() |
void |
paintCursor(Graphics gr) |
protected void |
paintCursor(Graphics gr,
boolean clearIt)
Paint/toggle the cursor.
|
boolean |
paintLastChar(Graphics g) |
boolean |
paintLastChar(Graphics g,
boolean eraseIt) |
void |
penDoubleClicked(Point where)
Called if the Pen or Mouse button is double clicked on the Control.
|
void |
penPressed(Point where)
Called when the Pen or Mouse button is pressed on the control.
|
void |
penReleased(Point where)
Called when the Pen or Mouse button is released on the control.
|
protected void |
popupMenuClosed(Menu m)
This gets closed after the popup menu for the Control has closed.
|
boolean |
replaceSelection(Object with) |
void |
resizeTo(int width,
int height)
This is called to change the width and height values.
|
void |
selectAll() |
protected void |
setNativeInputFlags(TextInputParameters tip) |
void |
setText(String txt)
Set the text of the Control, automatically repainting it.
|
void |
startDragging(DragContext dc)
This is called to indicate the start of a pen/mouse drag operation.
|
protected void |
startLocalInput(boolean selectAll) |
void |
stopActiveInput() |
protected void |
stopAllInput() |
void |
ticked(Object id,
long elapsed) |
void |
update() |
void |
updateText(boolean generateEvent) |
protected void |
updateText(boolean generateEvent,
boolean fromEnter) |
boolean |
validateText(String what)
This is used to validate any new text.
|
calculateInputFlags, checkInputMethod, checkSipCoverage, dataBeingRemoved, dataTransferCancelled, fixCase, getBestPassiveFlags, getColors, getNativeInputParameters, hasChanged, inActivePassiveInput, isLabel, keepConditionalChar, nativeInputStopped, onControlEvent, setAsLabel, setConditionalChar, showHoldDownIndicator, startActiveInput, startNativeInput, takeData, updateData, verifyWantDrag, verifyWantHoldDown
activate, addListener, amOnTopFrame, applyFontChange, baseOnPenEvent, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, cache, calculatedSizes, 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, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, deactivate, defaultTo, deferInWindowThread, doAction, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintData, 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, 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, onLabelPenEvent, onPenEvent, paintBackground, paintWithControlPainter, pauseEventThread, penClicked, penHeld, penRightReleased, popupBeep, 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, 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, setTextSize, setTiledBackgroundImage, setToolTip, shown, simulateClickOn, simulateKeyPresses, simulateKeyType, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, stopDragging, takeFocus, takeFromClipboard, takePromptControl, testInWindowThread, tipIsDisplayed, toClipboard, toField, toField, toIDString, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryGetGraphics, tryNext, tryStartMenu, unhide, unlock, updateDCDuringDD, updateFrom, updateTo, waitEventThread, willAcceptDrop, willShowFrame, windowHasFloatingControls, writeLock
doubleSizeIt, getGuiTextHeight, isDoubleSized, isDoubleSizedFont, loadImage, tryLoadImage
public static int DefaultSpacing
public int spacing
public int minXScroll
public boolean isPassword
public int clicksToFireAction
public int maxLength
public boolean wantReturn
public boolean dataChangeOnEachKey
public static final int DATA_CHANGED_BY_ENTER
public boolean noFocusHighlight
protected int leftMost
protected int numDisplayed
protected int startSel
protected int endSel
protected int cursorPos
protected boolean cursorOn
protected boolean hasCursor
public char passwordCharacter
public static String hidden
public Vector extraTools
public Input()
public Input(String txt)
public Input initializeData(String text)
text
- protected boolean doShowMenu(Point p)
Control
doShowMenu
in class Control
p
- The point where the pen was pressed.protected void popupMenuClosed(Menu m)
Control
popupMenuClosed
in class Control
public void setText(String txt)
Control
public static void calculatePreferredSize(FontMetrics fm, int columns, int spacing, Dimension dim)
public static void calculatePreferredSize(Control c, int columns, int spacing)
protected void calculateSizes()
Control
calculateSizes
in class Control
public void cursorToEnd()
protected boolean getCharRect(int which, Rect dest)
public void ticked(Object id, long elapsed)
public void gotFocus(int how)
Control
protected void stopAllInput()
public void lostFocus(int how)
Control
public void stopActiveInput()
public void updateText(boolean generateEvent)
protected void updateText(boolean generateEvent, boolean fromEnter)
public char getPasswordCharacter()
getPasswordCharacter
in class Control
public String getDisplay(String s)
s
- The data String to display.protected void doPaintData(Graphics gr)
Control
doPaintData
in class Control
gr
- The Graphics object to paint to.public void doPaint(Graphics g, Rect area)
Control
public void paintCursor()
public void paintCursor(Graphics gr)
public void clearCursor()
protected void paintCursor(Graphics gr, boolean clearIt)
gr
- a Graphics to draw to. This may be null.clearIt
- true to clear the cursor.public boolean paintLastChar(Graphics g)
public boolean paintLastChar(Graphics g, boolean eraseIt)
public boolean paintConditionalChar(Graphics gr, boolean underlined)
paintConditionalChar
in class EditControl
public Input addExtraTool(Input.ExtraTool tool)
protected int getWidthForExtraTools()
protected int getTextAreaWidth()
protected boolean fix()
public boolean validateText(String what)
public void newText(String what, int newCursorPos)
public void newText(String what, int newCursorPos, boolean repaintAll)
protected void moveCursorPos(int where, boolean takeSelection)
protected void newCursorPos(int where, boolean takeSelection)
protected void newCursorPos(int where)
public boolean deleteSelection()
deleteSelection
in interface Selectable
public boolean replaceSelection(Object with)
replaceSelection
in interface Selectable
public Object getSelection()
getSelection
in interface Selectable
protected void startLocalInput(boolean selectAll)
startLocalInput
in class EditControl
protected void setNativeInputFlags(TextInputParameters tip)
setNativeInputFlags
in class EditControl
protected void enterOrEscapePressed(boolean isEnter)
public void onKeyEvent(KeyEvent ev)
onKeyEvent
in class Control
public int findPressedChar(Point where)
public boolean hasSelection()
hasSelection
in interface Selectable
public void selectAll()
selectAll
in class EditControl
public boolean noSelection()
noSelection
in interface Selectable
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 penReleased(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.
penReleased
in class Control
where
- The point on the Control where the pen was released.public void penDoubleClicked(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.
By default this method simply calls the penClicked() method.
penDoubleClicked
in class Control
where
- The point on the Control where the pen was double-clicked.public void startDragging(DragContext dc)
Control
startDragging
in class Control
dc
- A DragContext indicating information about the dragging.public void dragged(DragContext dc)
Control
protected void doDragAt(Point p)
public void resizeTo(int width, int height)
Control
public boolean acceptsData(Object data, DragContext how)
Control
acceptsData
in class EditControl
data
- The data to be transferred.how
- if the transfer is via DragAndDrop this will be a DragContext object,
otherwise it will be null to indicate a clipboard operation.public void update()
update
in class EditControl
public Range getSelectionRange()
public int getCursorPosition()
public static String execute(String originalText, Control parent, int x, int y, int width, int height, int options)
originalText
- parent
- x
- y
- width
- height
- options
- public int execute(Control parent, int x, int y, int width, int height, int options)
parent
- x
- y
- width
- height
- options
-