Package com.spinyowl.legui.component
Class TextAreaField
java.lang.Object
com.spinyowl.legui.component.Component
com.spinyowl.legui.component.AbstractTextComponent
com.spinyowl.legui.component.TextAreaField
- All Implemented Interfaces:
TextComponent,Serializable
TextAreaField is multiline text component which allow to enter text.
- See Also:
-
Field Summary
Fields inherited from class com.spinyowl.legui.component.AbstractTextComponent
textState -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TextAreaField(float x, float y, float width, float height) Constructor with position and size parameters.TextAreaField(String text) Default constructor with text.TextAreaField(String text, float x, float y, float width, float height) Constructor with text, position and size parameters.TextAreaField(String text, org.joml.Vector2f position, org.joml.Vector2f size) Constructor with text, position and size parameters.TextAreaField(org.joml.Vector2f position, org.joml.Vector2f size) Constructor with position and size parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintReturns caret position.intReturns end selection index.floatfloatintReturns mouse caret position.Returns selected text.intReturns start selection index.intReturns tab size in spaces.inthashCode()booleanReturns true if text is editable.booleanIf returns true - caret position during rendering will stick to 0/mid/end depending on alignmentvoidsetCaretPosition(int caretPosition) Used to set caret position.voidsetEditable(boolean editable) Used to set editable text or not.voidsetEndSelectionIndex(int endSelectionIndex) Used to set end selection index.voidsetMouseCaretPosition(int mouseCaretPosition) Used to set mouse caret position.voidsetStartSelectionIndex(int startSelectionIndex) Used to set start selection index.voidsetStickToAlignment(boolean stickToAlignment) voidsetTabSize(int tabSize) Used to set tab size in spaces.toString()Methods inherited from class com.spinyowl.legui.component.AbstractTextComponent
getTextState, setTextStateMethods inherited from class com.spinyowl.legui.component.Component
add, add, addAll, clearChildComponents, containerIterator, contains, containsAll, count, forEach, getAbsolutePosition, getChildComponents, getFocusedStyle, getFrame, getHoveredStyle, getIntersector, getLayer, getListenerMap, getMetadata, getParent, getPosition, getPressedStyle, getSize, getStyle, getTabIndex, getTooltip, indexOfChild, intersects, isEmpty, isEnabled, isFocusable, isFocused, isHovered, isPressed, isTabFocusable, isVisible, keepRendering, keepRendering, parallelStream, remove, remove, removeAll, removeIf, setEnabled, setFocusable, setFocused, setHovered, setIntersector, setListenerMap, setParent, setPosition, setPosition, setPressed, setSize, setSize, setStyle, setTabFocusable, setTabIndex, setTooltip, stream
-
Constructor Details
-
TextAreaField
public TextAreaField()Default constructor. Used to create component instance without any parameters.Also if you want to make it easy to use with Json marshaller/unmarshaller component should contain empty constructor.
-
TextAreaField
public TextAreaField(float x, float y, float width, float height) Constructor with position and size parameters.- Parameters:
x- x position position in parent component.y- y position position in parent component.width- width of component.height- height of component.
-
TextAreaField
public TextAreaField(org.joml.Vector2f position, org.joml.Vector2f size) Constructor with position and size parameters.- Parameters:
position- position position in parent component.size- size of component.
-
TextAreaField
Default constructor with text.Also if you want to make it easy to use with Json marshaller/unmarshaller component should contain empty constructor.
- Parameters:
text- text to set.
-
TextAreaField
Constructor with text, position and size parameters.- Parameters:
text- text to set.x- x position position in parent component.y- y position position in parent component.width- width of component.height- height of component.
-
TextAreaField
Constructor with text, position and size parameters.- Parameters:
text- text to set.position- position position in parent component.size- size of component.
-
-
Method Details
-
getCaretPosition
public int getCaretPosition()Returns caret position.- Returns:
- caret position.
-
setCaretPosition
public void setCaretPosition(int caretPosition) Used to set caret position.- Parameters:
caretPosition- caret position to set.
-
isEditable
public boolean isEditable()Returns true if text is editable.- Returns:
- true if text is editable.
-
setEditable
public void setEditable(boolean editable) Used to set editable text or not.- Parameters:
editable- editable text or not.
-
getMouseCaretPosition
public int getMouseCaretPosition()Returns mouse caret position.- Returns:
- mouse caret position.
-
setMouseCaretPosition
public void setMouseCaretPosition(int mouseCaretPosition) Used to set mouse caret position.- Parameters:
mouseCaretPosition- mouse caret position to set.
-
getStartSelectionIndex
public int getStartSelectionIndex()Returns start selection index.- Returns:
- start selection index.
-
setStartSelectionIndex
public void setStartSelectionIndex(int startSelectionIndex) Used to set start selection index.- Parameters:
startSelectionIndex- start selection index to set.
-
getEndSelectionIndex
public int getEndSelectionIndex()Returns end selection index.- Returns:
- end selection index.
-
setEndSelectionIndex
public void setEndSelectionIndex(int endSelectionIndex) Used to set end selection index.- Parameters:
endSelectionIndex- end selection index to set.
-
getSelection
Returns selected text.- Returns:
- selected text.
-
getTabSize
public int getTabSize()Returns tab size in spaces.- Returns:
- tab size in spaces.
-
setTabSize
public void setTabSize(int tabSize) Used to set tab size in spaces.- Parameters:
tabSize- tab size in spaces.
-
equals
-
hashCode
public int hashCode() -
toString
-
getMaxTextWidth
public float getMaxTextWidth() -
getMaxTextHeight
public float getMaxTextHeight() -
getCaretX
-
getCaretY
-
isStickToAlignment
public boolean isStickToAlignment()If returns true - caret position during rendering will stick to 0/mid/end depending on alignment- Returns:
- true if caret position should stick to alignment during rendering
-
setStickToAlignment
public void setStickToAlignment(boolean stickToAlignment)
-