Package de.gurkenlabs.litiengine.gui
Class TextFieldComponent
java.lang.Object
de.gurkenlabs.litiengine.gui.GuiComponent
de.gurkenlabs.litiengine.gui.ImageComponent
de.gurkenlabs.litiengine.gui.TextFieldComponent
- All Implemented Interfaces:
IRenderable,Tweenable,MouseListener,MouseMotionListener,MouseWheelListener,EventListener
- Direct Known Subclasses:
NumberAdjuster
-
Field Summary
FieldsFields inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
BACKGROUND_DISABLED_INDEX, BACKGROUND_HOVER_INDEX, BACKGROUND_INDEX, BACKGROUND_PRESSED_INDEXFields inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
ICON_FONT -
Constructor Summary
ConstructorsConstructorDescriptionTextFieldComponent(double x, double y, double width, double height, String text) -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetText()Gets the entire Text associated with this GuiComponent.Gets only the non-cropped bits of Text visible on this GuiComponent.m To retrieve only the entire text associated with this GuiComponent, useGuiComponent.getText().voidhandleTypedKey(KeyEvent event) voidonChangeConfirmed(Consumer<String> cons) voidrender(Graphics2D g) Note: If you override this and are modifying swing components, be sure you are in the AWT thread when you do so!voidvoidsetFlickerDelay(int flickerDelayMillis) voidvoidsetMaxLength(int maxLength) voidSets the text.Methods inherited from class de.gurkenlabs.litiengine.gui.ImageComponent
getBackground, getImage, getImageAlign, getImageScaleMode, getImageValign, getSpritesheet, getSpritesheetScaleFactor, getSpritesheetScaleMode, rescaleImage, setHeight, setImage, setImageAlign, setImageScaleMode, setImageValign, setSpritesheet, setSpritesheet, setSpritesheet, setSpritesheetScaleFactor, setSpritesheetScaleMode, setWidthMethods inherited from class de.gurkenlabs.litiengine.gui.GuiComponent
addRenderedListener, addRenderListener, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getCenterX, getCenterY, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, getFont, getHeight, getHoverConsumer, getHoverSound, getLocation, getMouseDraggedConsumer, getMouseEnterConsumer, getMouseLeaveConsumer, getMouseMovedConsumer, getMousePressedConsumer, getMouseReleasedConsumer, getMouseWheelConsumer, getName, getShape, getTag, getTextAlign, getTextAngle, getTextShadowColor, getTextShadowRadius, getTextValign, getTextX, getTextY, getTweenValues, getWidth, getX, getY, hasAutomaticLineBreaks, hasTextAntialiasing, hasTextShadow, initializeComponents, isEnabled, isForwardMouseEvents, isHovered, isPressed, isSelected, isSuspended, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseEventShouldBeForwarded, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onClicked, onHovered, onMouseDragged, onMouseEnter, onMouseLeave, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelScrolled, onTextChanged, prepare, removeListener, removeListener, setAutomaticLineBreaks, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setTextAlign, setTextAngle, setTextAntialiasing, setTextShadow, setTextShadowColor, setTextShadowRadius, setTextValign, setTextX, setTextY, setTweenValues, setVisible, setX, setY, suspend, toggleSelection, toggleSuspension
-
Field Details
-
DOUBLE_FORMAT
- See Also:
-
INTEGER_FORMAT
- See Also:
-
-
Constructor Details
-
TextFieldComponent
-
-
Method Details
-
getFormat
-
setFormat
-
getCursor
-
setCursor
-
getMaxLength
public int getMaxLength() -
setMaxLength
public void setMaxLength(int maxLength) -
getText
Description copied from class:GuiComponentGets the entire Text associated with this GuiComponent. Parts of the Text may get cropped and can therefore be invisible. To retrieve only the visible part of the text, useGuiComponent.getTextToRender(Graphics2D g).- Overrides:
getTextin classGuiComponent- Returns:
- the entire text on this GuiComponent
-
setText
Description copied from class:GuiComponentSets the text.- Overrides:
setTextin classGuiComponent- Parameters:
text- the new text
-
getTextToRender
Description copied from class:GuiComponentGets only the non-cropped bits of Text visible on this GuiComponent.m To retrieve only the entire text associated with this GuiComponent, useGuiComponent.getText().- Overrides:
getTextToRenderin classGuiComponent- Parameters:
g- The graphics object to render on.- Returns:
- the text to render
-
handleTypedKey
-
canHandleInput
public boolean canHandleInput() -
onChangeConfirmed
-
render
Description copied from class:GuiComponentNote: If you override this and are modifying swing components, be sure you are in the AWT thread when you do so!- Specified by:
renderin interfaceIRenderable- Overrides:
renderin classImageComponent- Parameters:
g- The current graphics object onto which this instance will render its visual contents.- See Also:
-
setFlickerDelay
public void setFlickerDelay(int flickerDelayMillis)
-