Class TSimpleTextFieldWidget
java.lang.Object
com.thecsdev.common.scene.Node<TElement>
com.thecsdev.commonmc.api.client.gui.TElement
com.thecsdev.commonmc.api.client.gui.widget.TClickableWidget
com.thecsdev.commonmc.api.client.gui.widget.text.TSimpleTextFieldWidget
- All Implemented Interfaces:
INode<TElement>, INodeBounded<TElement,Bounds2i>, INodeRenderable<TElement, TGuiGraphics>, Iterable<TElement>, Collection<TElement>
Text input widget where the user may type in text. Very minimal and
does not feature the concept of cursors and multiline support.
- API Note:
- Uses unoptimal practices that cost extra memory and performance.
-
Field Summary
Fields inherited from class TClickableWidget
eClicked, ONCLICK_SOUNDFields inherited from class TElement
eInitialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal NotNullProperty<net.minecraft.client.gui.Font> @NotNull CursorTypeReturnsCursorTypethat represents the visual look the user's mouse cursor should have when thisTElementis hovered.final TLabelElementReturns theTLabelElementthat displays the placeholder text.
Your access to this label is intended for label property changing only!final TLabelElementReturns theTLabelElementthat displays the user-typed text.
Your access to this label is intended for label property changing only!protected final voidCallback method that is invoked when thisTElementis initializing.final booleaninputBackspace(int amount) Inputs backspace.final booleaninputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull TInputContext context) A callback method that is invoked when the user makes an input.final booleanInputs a textualString.final NotNullProperty<net.minecraft.network.chat.Component> TheNotNullPropertyfor thisTSimpleTextFieldWidget's placeholder text that is rendered when the user has yet to input (type) something.voidpostRenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked after thisNodeand all of their children have been rendered.voidrenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked when thisNodeis being rendered.final NotNullProperty<String> TheNotNullPropertyholding thisTSimpleTextFieldWidget's text the user typed in.Methods inherited from class TClickableWidget
click, clickCallback, dragEndCallback, dragStartCallback, enabledProperty, focusLostCallback, hoverGainedCallback, isFocusable, pressedPropertyMethods inherited from class TElement
addRel, boundsProperty, clearAndInit, clipsDescendantsProperty, contextMenuProperty, findElementAt, focusableProperty, focusGainedCallback, forEachVisible, getBaseType, getBounds, getClient, getContentBounds, getSelf, getTooltip, hoverableProperty, hoverLostCallback, invalidateTooltipCache, isFocused, isHoverable, isHovered, isHoveredOrFocused, isVisible, move, moveChildren, moveTo, removeRel, screenProperty, setBounds, setBounds, setBounds, showContextMenu, tickCallback, tooltipProperty, toString, visiblePropertyMethods inherited from class Node
add, addAll, childAddedCallback, childRemovedCallback, clear, contains, containsAll, equals, findChild, findParent, findSibling, forEach, get, getFirst, getLast, getParent, hashCode, indexOf, isEmpty, iterator, parentProperty, remove, remove, remove, removeAll, retainAll, rootProperty, size, toArray, toArray
-
Constructor Details
-
TSimpleTextFieldWidget
public TSimpleTextFieldWidget()
-
-
Method Details
-
textProperty
TheNotNullPropertyholding thisTSimpleTextFieldWidget's text the user typed in. -
fontProperty
-
placeholderProperty
TheNotNullPropertyfor thisTSimpleTextFieldWidget's placeholder text that is rendered when the user has yet to input (type) something. -
getTextLabel
Returns theTLabelElementthat displays the user-typed text.
Your access to this label is intended for label property changing only! -
getPlaceholderLabel
Returns theTLabelElementthat displays the placeholder text.
Your access to this label is intended for label property changing only! -
getCursor
Description copied from class:TElementReturnsCursorTypethat represents the visual look the user's mouse cursor should have when thisTElementis hovered.- Overrides:
getCursorin classTClickableWidget
-
initCallback
protected final void initCallback()Description copied from class:TElementCallback method that is invoked when thisTElementis initializing. You may override this method to create and add childTElements.- Overrides:
initCallbackin classTElement- See Also:
-
renderCallback
Description copied from interface:INodeRenderableCallback method that is invoked when thisNodeis being rendered.- Specified by:
renderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
renderCallbackin classTElement- Parameters:
pencil- The rendering context.
-
postRenderCallback
Description copied from interface:INodeRenderableCallback method that is invoked after thisNodeand all of their children have been rendered.- Specified by:
postRenderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
postRenderCallbackin classTClickableWidget- Parameters:
pencil- The rendering context.
-
inputCallback
public final boolean inputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull @NotNull TInputContext context) Description copied from class:TElementA callback method that is invoked when the user makes an input.- Overrides:
inputCallbackin classTClickableWidget- Parameters:
phase- The input discovery phase.context- Information about the user's input.- Returns:
trueif thisTElementhandled the input.
-
inputText
-
inputBackspace
public final boolean inputBackspace(int amount) Inputs backspace.- Parameters:
amount- The amount of times to input backspace.- Returns:
trueif the text changed as a result of this operation.
-