ChatboxTextInput

Methods
30
Fields
None

Getting one

chatboxPanelManager:openTextInput(…)
ChatboxTextInput.new(…)

Methods

MethodReturnsDescription
addCharValidator(any)ChatboxTextInputAlso require validator(c) (c a character's code point) of every character typed, pasted or set; returns the panel.
charValidator(any)ChatboxTextInputReplace the validator (nil: printable ASCII); returns the panel.
lines(number)ChatboxTextInputWrap the text over at most lines lines (0: as many as it takes); returns the panel.
prompt(string)ChatboxTextInputSet the prompt; returns the panel.
value(string)ChatboxTextInputSet the text (characters the validator refuses left out), the cursor at its end; returns the panel.
cursorAt(number, number?)ChatboxTextInputPut the cursor at indexA, or select indexA..indexB; returns the panel.
getValue()stringThe text.
onClose(() -> ())ChatboxTextInputWhat runs when the panel closes, however it closes; returns the panel.
onDone((string) -> boolean?)ChatboxTextInputWhat runs with the text on Enter; only an explicit false keeps the panel open. Returns the panel.
onChanged((string) -> ())ChatboxTextInputWhat runs with the text each time an edit changes it; returns the panel.
fontID(number)ChatboxTextInputThe font (FontID, QUILL_8 unless set); returns the panel.
getPrompt()string?The prompt.
getLines()numberWhat lines set.
getCursorStart()numberThe cursor, or the selection's start.
getCursorEnd()numberThe cursor, or the selection's end.
getCharValidator()anyThe validator.
getOnClose()anyWhat onClose set.
getOnDone()anyWhat onDone set.
getOnChanged()anyWhat onChanged set.
getFontID()numberThe font.
isBuilt()booleanWhether the panel has been opened.
update()()Redraw the panel: the prompt, then buildEdit(0, 50, width, 0). A subclass overrides it to draw its own.
buildEdit(number, number, number, number)()Draw the text, its selection and the cursor at (x, y) over w (centred when w > 0), each line h high (0: the font's baseline).
build()ChatboxTextInputOpen the panel (a prompt first, else IllegalStateException); returns it.
keyTyped(AwtKeyEvent)()Insert the character typed, over the selection.
keyPressed(AwtKeyEvent)()The editing keys: Ctrl+X/C/V/A, Delete, Backspace, the arrows (Shift selects), Home, End, Enter (onDone, then close) and Escape.
keyReleased(AwtKeyEvent)()Nothing.
mousePressed(AwtMouseEvent)AwtMouseEventA left press on the text moves the cursor there (Shift extends the selection); the event goes on.
mouseDragged(AwtMouseEvent)AwtMouseEventA left drag selects; the event goes on.
new(ChatboxPanelManager?, ClientThread?)ChatboxTextInputBuilds a text input: ChatboxTextInput.new(chatboxPanelManager, clientThread).

Returned by

MethodReturnsDescription
ChatboxPanelManager.openTextInputChatboxTextInputA new text input panel prompting prompt, to set up and open with build.
ChatboxTextInputClass.newChatboxTextInputBuilds a text input: ChatboxTextInput.new(chatboxPanelManager, clientThread).

Method details

update

update: (ChatboxTextInput) -> ()

Redraw the panel: the prompt, then buildEdit(0, 50, width, 0). A subclass overrides it to draw its own.

buildEdit

buildEdit: (ChatboxTextInput, number, number, number, number) -> ()

Draw the text, its selection and the cursor at (x, y) over w (centred when w > 0), each line h high (0: the font's baseline).

keyPressed

keyPressed: (ChatboxTextInput, AwtKeyEvent) -> ()

The editing keys: Ctrl+X/C/V/A, Delete, Backspace, the arrows (Shift selects), Home, End, Enter (onDone, then close) and Escape.