public class TextState
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
TextState()
Default constructor.
|
TextState(java.lang.String text)
Used to create TextState with predefined text.
|
Modifier and Type | Method and Description |
---|---|
java.lang.StringBuffer |
append(boolean b)
Appends the string representation of the
boolean argument to the sequence. |
java.lang.StringBuffer |
append(char c)
Appends the string representation of the
char argument to this sequence. |
java.lang.StringBuffer |
append(char[] str)
Appends the string representation of the
char array argument to this sequence. |
java.lang.StringBuffer |
append(char[] str,
int offset,
int len)
Appends the string representation of a subarray of the
char array argument to this sequence. |
void |
append(java.lang.Character c)
Used to append character to text.
|
java.lang.StringBuffer |
append(java.lang.CharSequence s)
Appends the specified
CharSequence to this sequence. |
java.lang.StringBuffer |
append(java.lang.CharSequence s,
int start,
int end)
Appends a subsequence of the specified
CharSequence to this sequence. |
java.lang.StringBuffer |
append(double d)
Appends the string representation of the
double argument to this sequence. |
java.lang.StringBuffer |
append(float f)
Appends the string representation of the
float argument to this sequence. |
java.lang.StringBuffer |
append(int i)
Appends the string representation of the
int argument to this sequence. |
java.lang.StringBuffer |
append(long l)
Appends the string representation of the
long argument to this sequence. |
java.lang.StringBuffer |
append(java.lang.Object obj)
Appends the string representation of the
Object argument. |
java.lang.StringBuffer |
append(java.lang.String str)
Appends the specified string to this character sequence.
|
java.lang.StringBuffer |
append(java.lang.StringBuffer sb)
Appends the specified
StringBuffer to this sequence. |
java.lang.StringBuffer |
appendCodePoint(int codePoint)
Appends the string representation of the
codePoint argument to this sequence. |
int |
capacity()
Returns text buffer capacity.
|
char |
charAt(int index)
Returns the
char value at the specified index. |
java.util.stream.IntStream |
chars()
Returns a stream of
int zero-extending the char values from this sequence. |
int |
codePointAt(int index)
Returns the character (Unicode code point) at the specified index.
|
int |
codePointBefore(int index)
Returns the character (Unicode code point) before the specified index.
|
int |
codePointCount(int beginIndex,
int endIndex)
Returns the number of Unicode code points in the specified text range of this sequence.
|
java.util.stream.IntStream |
codePoints()
Returns a stream of code point values from this sequence.
|
void |
copy(TextState state)
Used to copy provided text state to current state.
|
java.lang.StringBuffer |
delete(int start,
int end)
Removes the characters in a substring of this sequence.
|
java.lang.StringBuffer |
deleteCharAt(int index)
Removes the
char at the specified position in this sequence. |
void |
ensureCapacity(int minimumCapacity)
Ensures that the capacity is at least equal to the specified minimum.
|
boolean |
equals(java.lang.Object o)
.
|
int |
getCaretPosition()
Returns caret position.
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Characters are copied from this sequence into the destination character array dst.
|
int |
getEndSelectionIndex()
Returns end selection index.
|
java.lang.String |
getFont()
Returns current font name.
|
float |
getFontSize()
Returns font size.
|
org.joml.Vector4f |
getHighlightColor()
Returns highlight color.
|
HorizontalAlign |
getHorizontalAlign()
Returns horizontal alignment.
|
int |
getMouseCaretPosition()
Returns mouse caret position.
|
org.joml.Vector4f |
getPadding()
Returns padding.
|
java.lang.String |
getSelection()
Returns selected text.
|
int |
getStartSelectionIndex()
Returns start selection index.
|
java.lang.String |
getText()
Returns text.
|
org.joml.Vector4f |
getTextColor()
Returns text color.
|
VerticalAlign |
getVerticalAlign()
Returns vertical alignment.
|
int |
hashCode()
.
|
int |
indexOf(java.lang.String str)
Returns the index within this string of the first occurrence of the specified substring.
|
int |
indexOf(java.lang.String str,
int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
|
java.lang.StringBuffer |
insert(int offset,
boolean b)
Inserts the string representation of the
boolean argument into this sequence. |
java.lang.StringBuffer |
insert(int offset,
char c)
Inserts the string representation of the
char argument into this sequence. |
java.lang.StringBuffer |
insert(int offset,
char[] str)
Inserts the string representation of the
char array argument into this sequence. |
java.lang.StringBuffer |
insert(int index,
char[] str,
int offset,
int len)
Inserts the string representation of a subarray of the
str array argument into this sequence. |
java.lang.StringBuffer |
insert(int dstOffset,
java.lang.CharSequence s)
Inserts the specified
CharSequence into this sequence. |
java.lang.StringBuffer |
insert(int dstOffset,
java.lang.CharSequence s,
int start,
int end)
Inserts a subsequence of the specified
CharSequence into this sequence. |
java.lang.StringBuffer |
insert(int offset,
double d)
Inserts the string representation of the
double argument into this sequence. |
java.lang.StringBuffer |
insert(int offset,
float f)
Inserts the string representation of the
float argument into this sequence. |
java.lang.StringBuffer |
insert(int offset,
int i)
Inserts the string representation of the second
int argument into this sequence. |
java.lang.StringBuffer |
insert(int offset,
long l)
Inserts the string representation of the
long argument into this sequence. |
java.lang.StringBuffer |
insert(int offset,
java.lang.Object obj)
Inserts the string representation of the
Object argument into this character sequence. |
java.lang.StringBuffer |
insert(int offset,
java.lang.String str)
Inserts the string into this character sequence.
|
boolean |
isEditable()
Returns true if text is editable.
|
int |
lastIndexOf(java.lang.String str)
Returns the index within this string of the rightmost occurrence of the specified substring.
|
int |
lastIndexOf(java.lang.String str,
int fromIndex)
Returns the index within this string of the last occurrence of the specified substring.
|
int |
length()
Returns text length.
|
int |
offsetByCodePoints(int index,
int codePointOffset)
Returns the index within this sequence that is offset from the given index by codePointOffset code points.
|
java.lang.StringBuffer |
replace(int start,
int end,
java.lang.String str)
Replaces the characters in a substring of this sequence with characters in the specified
String . |
java.lang.StringBuffer |
reverse()
Causes this character sequence to be replaced by the reverse of the sequence.
|
void |
setCaretPosition(int caretPosition)
Used to set caret position.
|
void |
setCharAt(int index,
char ch)
The character at the specified index is set to ch.
|
void |
setEditable(boolean editable)
Used to set editable text or not.
|
void |
setEndSelectionIndex(int endSelectionIndex)
Used to set end selection index.
|
void |
setFont(java.lang.String font)
Used to set new font.
|
void |
setFontSize(float fontSize)
Used to set new font size.
|
void |
setHighlightColor(float r,
float g,
float b,
float a)
Used to set highlight color.
|
void |
setHighlightColor(org.joml.Vector4f highlightColor)
Used to set highlight color.
|
void |
setHorizontalAlign(HorizontalAlign horizontalAlign)
Used to set horizontal alignment.
|
void |
setLength(int newLength)
Sets the length of the character sequence.
|
void |
setMouseCaretPosition(int mouseCaretPosition)
Used to set mouse caret position.
|
void |
setPadding(float left,
float top,
float right,
float bottom)
Used to set padding.
|
void |
setPadding(org.joml.Vector4f padding)
Used to set padding.
|
void |
setStartSelectionIndex(int startSelectionIndex)
Used to set start selection index.
|
void |
setText(java.lang.String text)
Used to set new text.
|
void |
setTextColor(float r,
float g,
float b,
float a)
Used to set text color.
|
void |
setTextColor(org.joml.Vector4f textColor)
Used to set text color.
|
void |
setVerticalAlign(VerticalAlign verticalAlign)
Used to set vertical alignment.
|
java.lang.CharSequence |
subSequence(int start,
int end)
Returns a new character sequence that is a subsequence of this sequence.
|
java.lang.String |
substring(int start)
Returns a new
String that contains a subsequence of characters currently contained in this character sequence. |
java.lang.String |
substring(int start,
int end)
Returns a new
String that contains a subsequence of characters currently contained in this sequence. |
java.lang.String |
toString()
.
|
void |
trimToSize()
Attempts to reduce storage used for the character sequence.
|
public TextState()
public TextState(java.lang.String text)
text
- text to set.public java.lang.String getFont()
public void setFont(java.lang.String font)
font
- new font.public float getFontSize()
public void setFontSize(float fontSize)
fontSize
- new font size.public HorizontalAlign getHorizontalAlign()
public void setHorizontalAlign(HorizontalAlign horizontalAlign)
horizontalAlign
- horizontal alignment.public VerticalAlign getVerticalAlign()
public void setVerticalAlign(VerticalAlign verticalAlign)
verticalAlign
- vertical alignment.public org.joml.Vector4f getTextColor()
public void setTextColor(org.joml.Vector4f textColor)
textColor
- text color.public void setTextColor(float r, float g, float b, float a)
r
- red component.g
- green component.b
- blue component.a
- alpha component.public org.joml.Vector4f getHighlightColor()
public void setHighlightColor(org.joml.Vector4f highlightColor)
highlightColor
- highlight color.public void setHighlightColor(float r, float g, float b, float a)
r
- red component.g
- green component.b
- blue component.a
- alpha component.public org.joml.Vector4f getPadding()
public void setPadding(org.joml.Vector4f padding)
padding
- text padding.public void setPadding(float left, float top, float right, float bottom)
left
- left paddingtop
- top paddingright
- right paddingbottom
- bottom paddingpublic void append(java.lang.Character c)
c
- character to append.public java.lang.String getText()
public void setText(java.lang.String text)
text
- new text.public int length()
StringBuffer.length()
public int capacity()
StringBuffer.capacity()
public void ensureCapacity(int minimumCapacity)
minimumCapacity
- - the minimum desired capacity.StringBuffer.ensureCapacity(int)
public void trimToSize()
StringBuffer.trimToSize()
public void setLength(int newLength)
newLength
- the new lengthjava.lang.IndexOutOfBoundsException
- if the newLength
argument is negative.StringBuffer.setLength(int)
public char charAt(int index)
char
value at the specified index.index
- the index of the char value to be returnedchar
valuejava.lang.IndexOutOfBoundsException
- if the index argument is negative or not less than length()StringBuffer.charAt(int)
public int codePointAt(int index)
index
- the index to the char
valuesindex
java.lang.IndexOutOfBoundsException
- if the index
argument is negative or not less than the length of this sequence.StringBuffer.codePointAt(int)
public int codePointBefore(int index)
index
- the index following the code point that should be returnedjava.lang.IndexOutOfBoundsException
- if the index
argument is less than 1 or greater than the length of this sequence.StringBuffer.codePointBefore(int)
public int codePointCount(int beginIndex, int endIndex)
beginIndex
- the index to the first char
of the text range.endIndex
- the index after the last char
of the text range.java.lang.IndexOutOfBoundsException
- if the beginIndex
is negative, or endIndex
is larger than the length of this sequence, or beginIndex
is larger than endIndex
.StringBuffer.codePointCount(int, int)
public int offsetByCodePoints(int index, int codePointOffset)
index
- the index to be offsetcodePointOffset
- the offset in code pointsStringBuffer.offsetByCodePoints(int, int)
public java.util.stream.IntStream chars()
int
zero-extending the char
values from this sequence.CharSequence.chars()
public java.util.stream.IntStream codePoints()
CharSequence.codePoints()
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
srcBegin
- start copying at this offset.srcEnd
- stop copying at this offset.dst
- the array to copy the data into.dstBegin
- offset into dst.StringBuffer.getChars(int, int, char[], int)
public void setCharAt(int index, char ch)
index
- the index of the character to modify.ch
- the new character.StringBuffer.setCharAt(int, char)
public java.lang.StringBuffer append(java.lang.Object obj)
Object
argument.obj
- an Object
.StringBuffer.append(Object)
public java.lang.StringBuffer append(java.lang.String str)
str
- a string.StringBuffer.append(String)
public java.lang.StringBuffer append(java.lang.StringBuffer sb)
StringBuffer
to this sequence.sb
- the StringBuffer
to append.StringBuffer.append(StringBuffer)
public java.lang.StringBuffer append(java.lang.CharSequence s)
CharSequence
to this sequence.s
- the CharSequence
to append.StringBuffer.append(CharSequence)
public java.lang.StringBuffer append(java.lang.CharSequence s, int start, int end)
CharSequence
to this sequence.s
- the sequence to append.start
- the starting index of the subsequence to be appended.end
- the end index of the subsequence to be appended.java.lang.IndexOutOfBoundsException
- if start
is negative, or start
is greater than end
or end
is greater than s.length()
StringBuffer.append(CharSequence, int, int)
public java.lang.StringBuffer append(char[] str)
char
array argument to this sequence.str
- the characters to be appended.StringBuffer.append(char[])
public java.lang.StringBuffer append(char[] str, int offset, int len)
char
array argument to this sequence.str
- the characters to be appended.offset
- the index of the first char
to append.len
- the number of char
s to append.java.lang.IndexOutOfBoundsException
- if offset < 0
or len < 0
or offset+len > str.length
StringBuffer.append(char[], int, int)
public java.lang.StringBuffer append(boolean b)
boolean
argument to the sequence.b
- a boolean
.StringBuffer.append(boolean)
public java.lang.StringBuffer append(char c)
char
argument to this sequence.c
- a char
.StringBuffer.append(char)
public java.lang.StringBuffer append(int i)
int
argument to this sequence.i
- an int
.StringBuffer.append(int)
public java.lang.StringBuffer appendCodePoint(int codePoint)
codePoint
argument to this sequence.codePoint
- a Unicode code pointjava.lang.IllegalArgumentException
- if the specified codePoint
isn't a valid Unicode code pointStringBuffer.appendCodePoint(int)
public java.lang.StringBuffer append(long l)
long
argument to this sequence.l
- a long
.StringBuffer.append(long)
public java.lang.StringBuffer append(float f)
float
argument to this sequence.f
- a float
.StringBuffer.append(float)
public java.lang.StringBuffer append(double d)
double
argument to this sequence.d
- a double
.StringBuffer.append(double)
public java.lang.StringBuffer delete(int start, int end)
start
- The beginning index, inclusive.end
- The ending index, exclusive.java.lang.StringIndexOutOfBoundsException
- if start
is negative, greater than length()
, or greater than end
.StringBuffer.delete(int, int)
public java.lang.StringBuffer deleteCharAt(int index)
char
at the specified position in this sequence.index
- Index of char
to removejava.lang.StringIndexOutOfBoundsException
- if the index
is negative or greater than or equal to length()
.StringBuffer.deleteCharAt(int)
public java.lang.StringBuffer replace(int start, int end, java.lang.String str)
String
.start
- The beginning index, inclusive.end
- The ending index, exclusive.str
- String that will replace previous contents.java.lang.StringIndexOutOfBoundsException
- if start
is negative, greater than length()
, or greater than end
.StringBuffer.replace(int, int, String)
public java.lang.String substring(int start)
String
that contains a subsequence of characters currently contained in this character sequence.start
- The beginning index, inclusive.java.lang.StringIndexOutOfBoundsException
- if start
is less than zero, or greater than the length of this object.StringBuffer.substring(int)
public java.lang.CharSequence subSequence(int start, int end)
start
- the start index, inclusive.end
- the end index, exclusive.java.lang.IndexOutOfBoundsException
- if start
or end
are negative, if end
is greater than length()
, or if start
is
greater than end
StringBuffer.subSequence(int, int)
public java.lang.String substring(int start, int end)
String
that contains a subsequence of characters currently contained in this sequence.start
- The beginning index, inclusive.end
- The ending index, exclusive.java.lang.StringIndexOutOfBoundsException
- if start
or end
are negative or greater than length()
, or start
is greater than
end
.StringBuffer.substring(int, int)
public java.lang.StringBuffer insert(int index, char[] str, int offset, int len)
str
array argument into this sequence.index
- position at which to insert subarray.str
- A char
array.offset
- the index of the first char
in subarray to be inserted.len
- the number of char
s in the subarray to be inserted.java.lang.StringIndexOutOfBoundsException
- if index
is negative or greater than length()
, or offset
or len
are negative, or
(offset+len)
is greater than str.length
.StringBuffer.insert(int, char[], int, int)
public java.lang.StringBuffer insert(int offset, java.lang.Object obj)
Object
argument into this character sequence.offset
- the offset.obj
- an Object
.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, Object)
public java.lang.StringBuffer insert(int offset, java.lang.String str)
offset
- the offset.str
- a string.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, String)
public java.lang.StringBuffer insert(int offset, char[] str)
char
array argument into this sequence.offset
- the offset.str
- a character array.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, char[])
public java.lang.StringBuffer insert(int dstOffset, java.lang.CharSequence s)
CharSequence
into this sequence.dstOffset
- the offset.s
- the sequence to be insertedjava.lang.IndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, CharSequence)
public java.lang.StringBuffer insert(int dstOffset, java.lang.CharSequence s, int start, int end)
CharSequence
into this sequence.dstOffset
- the offset in this sequence.s
- the sequence to be inserted.start
- the starting index of the subsequence to be inserted.end
- the end index of the subsequence to be inserted.java.lang.IndexOutOfBoundsException
- if dstOffset
is negative or greater than this.length()
, or start
or end
are negative,
or start
is greater than end
or end
is greater than s.length()
StringBuffer.insert(int, CharSequence, int, int)
public java.lang.StringBuffer insert(int offset, boolean b)
boolean
argument into this sequence.offset
- the offset.b
- a boolean
.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, boolean)
public java.lang.StringBuffer insert(int offset, char c)
char
argument into this sequence.offset
- the offset.c
- a char
.java.lang.IndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, char)
public java.lang.StringBuffer insert(int offset, int i)
int
argument into this sequence.offset
- the offset.i
- an int
.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, int)
public java.lang.StringBuffer insert(int offset, long l)
long
argument into this sequence.offset
- the offset.l
- a long
.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, long)
public java.lang.StringBuffer insert(int offset, float f)
float
argument into this sequence.offset
- the offset.f
- a float
.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, float)
public java.lang.StringBuffer insert(int offset, double d)
double
argument into this sequence.offset
- the offset.d
- a double
.java.lang.StringIndexOutOfBoundsException
- if the offset is invalid.StringBuffer.insert(int, double)
public int indexOf(java.lang.String str)
str
- any string.-1
is returned.StringBuffer.indexOf(String)
public int indexOf(java.lang.String str, int fromIndex)
str
- the substring for which to search.fromIndex
- the index from which to start the search.StringBuffer.indexOf(String, int)
public int lastIndexOf(java.lang.String str)
str
- the substring to search for.-1
is returned.StringBuffer.lastIndexOf(String)
public int lastIndexOf(java.lang.String str, int fromIndex)
str
- the substring to search for.fromIndex
- the index to start the search from.StringBuffer.lastIndexOf(String, int)
public java.lang.StringBuffer reverse()
StringBuffer.reverse()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void copy(TextState state)
state
- state to copy.public int getMouseCaretPosition()
public void setMouseCaretPosition(int mouseCaretPosition)
mouseCaretPosition
- mouse caret position to set.public boolean isEditable()
public void setEditable(boolean editable)
editable
- editable text or not.public int getCaretPosition()
public void setCaretPosition(int caretPosition)
caretPosition
- caret position to set.public int getStartSelectionIndex()
public void setStartSelectionIndex(int startSelectionIndex)
startSelectionIndex
- start selection index to set.public int getEndSelectionIndex()
public void setEndSelectionIndex(int endSelectionIndex)
endSelectionIndex
- end selection index to set.public java.lang.String getSelection()