Top Inners Fields Methods
com.sun.javafx.scene.text

public Interface TextLayout

Known Direct Implementers
com.sun.javafx.text.PrismTextLayout
Imports
javafx.scene.shape.PathElement, com.sun.javafx.geom.BaseBounds, .Shape, java.util.Objects

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public BaseBounds

Returns:

the layout bounds
getBounds
()

Returns the (logical) bounds of the layout minX is always zero minY is the ascent of the first line (negative) width the width of the widest line height the sum of all lines height Note that this width is different the wrapping width!

public BaseBounds
getBounds(TextSpan filter, BaseBounds bounds)

public PathElement[]
getCaretShape(int offset, boolean isLeading, float x, float y)

public TextLayout.Hit

Returns:

returns a Hit object containing character index, insertion index and position of cursor on the character.
getHitInfo
(float
x coordinate value.
x
,
float
y coordinate value.
y
)

Calculates character index and insertion index for the given coordinates and maps to Hit class.

public TextLine[]

Returns:

the text lines
getLines
()

Returns the lines of text layout.

public PathElement[]
getRange(int start, int end, int type, float x, float y)

public GlyphList[]

Returns:

the runs
getRuns
()

Returns the GlyphList of text layout.

public Shape

Returns:

the shape
getShape
(int
the type of the shapes to include
type
,
TextSpan filter)

Returns the shape of the entire text layout relative to the baseline of the first line.

public BaseBounds

Returns:

the visual bounds
getVisualBounds
(int type)

Returns the visual bounds of the layout using glyph bounding box

public boolean

Returns:

returns true is the call modifies the layout internal state.
setAlignment
(int alignment)

Sets the alignment for the TextLayout.

public boolean

Returns:

returns true is the call modifies the layout internal state.
setBoundsType
(int type)

Sets the bounds type for the TextLayout.

public boolean

Returns:

returns true is the call modifies the layout internal state.
setContent
(TextSpan[] spans)

Sets the content for the TextLayout.

public boolean

Returns:

returns true is the call modifies the layout internal state.
setContent
(String string, Object font)

Sets the content for the TextLayout.

public boolean

Returns:

returns true is the call modifies the layout internal state.
setDirection
(int direction)

Sets the direction (bidi algorithm's) for the TextLayout.

public boolean

Returns:

returns true is the call modifies the layout internal state.
setLineSpacing
(float spacing)

Sets the line spacing for the TextLayout.

public boolean

Returns:

returns true if the call modifies the layout internal state.
setTabSize
(int
the number of spaces represented by a tab. Default is 8. Minimum is 1, lower values will be clamped to 1.
spaces
)

Sets the tab size for the TextLayout.

public boolean

Returns:

returns true is the call modifies the layout internal state.
setWrapWidth
(float wrapWidth)

Sets the wrap width for the TextLayout.

Field Detail

ALIGN_CENTERback to summary
public static final int ALIGN_CENTER
ALIGN_JUSTIFYback to summary
public static final int ALIGN_JUSTIFY
ALIGN_LEFTback to summary
public static final int ALIGN_LEFT
ALIGN_MASKback to summary
public static final int ALIGN_MASK
ALIGN_RIGHTback to summary
public static final int ALIGN_RIGHT
ANALYSIS_MASKback to summary
public static final int ANALYSIS_MASK
BOUNDS_CENTERback to summary
public static final int BOUNDS_CENTER
BOUNDS_MASKback to summary
public static final int BOUNDS_MASK
DEFAULT_TAB_SIZEback to summary
public static final int DEFAULT_TAB_SIZE
DIRECTION_DEFAULT_LTRback to summary
public static final int DIRECTION_DEFAULT_LTR
DIRECTION_DEFAULT_RTLback to summary
public static final int DIRECTION_DEFAULT_RTL
DIRECTION_LTRback to summary
public static final int DIRECTION_LTR
DIRECTION_MASKback to summary
public static final int DIRECTION_MASK
DIRECTION_RTLback to summary
public static final int DIRECTION_RTL
FLAGS_ANALYSIS_VALIDback to summary
public static final int FLAGS_ANALYSIS_VALID
FLAGS_CACHED_STRIKETHROUGHback to summary
public static final int FLAGS_CACHED_STRIKETHROUGH
FLAGS_CACHED_UNDERLINEback to summary
public static final int FLAGS_CACHED_UNDERLINE
FLAGS_HAS_BIDIback to summary
public static final int FLAGS_HAS_BIDI
FLAGS_HAS_CJKback to summary
public static final int FLAGS_HAS_CJK
FLAGS_HAS_COMPLEXback to summary
public static final int FLAGS_HAS_COMPLEX
FLAGS_HAS_EMBEDDEDback to summary
public static final int FLAGS_HAS_EMBEDDED
FLAGS_HAS_TABSback to summary
public static final int FLAGS_HAS_TABS
FLAGS_LASTback to summary
public static final int FLAGS_LAST
FLAGS_LINES_VALIDback to summary
public static final int FLAGS_LINES_VALID
FLAGS_RTL_BASEback to summary
public static final int FLAGS_RTL_BASE
FLAGS_WRAPPEDback to summary
public static final int FLAGS_WRAPPED
TYPE_BASELINEback to summary
public static final int TYPE_BASELINE
TYPE_BEARINGSback to summary
public static final int TYPE_BEARINGS
TYPE_STRIKETHROUGHback to summary
public static final int TYPE_STRIKETHROUGH
TYPE_TEXTback to summary
public static final int TYPE_TEXT
TYPE_TOPback to summary
public static final int TYPE_TOP
TYPE_UNDERLINEback to summary
public static final int TYPE_UNDERLINE

Method Detail

getBoundsback to summary
public BaseBounds getBounds()

Returns the (logical) bounds of the layout minX is always zero minY is the ascent of the first line (negative) width the width of the widest line height the sum of all lines height Note that this width is different the wrapping width!

Returns:BaseBounds

the layout bounds

getBoundsback to summary
public BaseBounds getBounds(TextSpan filter, BaseBounds bounds)
getCaretShapeback to summary
public PathElement[] getCaretShape(int offset, boolean isLeading, float x, float y)
getHitInfoback to summary
public TextLayout.Hit getHitInfo(float x, float y)

Calculates character index and insertion index for the given coordinates and maps to Hit class.

Parameters
x:float

x coordinate value.

y:float

y coordinate value.

Returns:TextLayout.Hit

returns a Hit object containing character index, insertion index and position of cursor on the character.

getLinesback to summary
public TextLine[] getLines()

Returns the lines of text layout.

Returns:TextLine[]

the text lines

getRangeback to summary
public PathElement[] getRange(int start, int end, int type, float x, float y)
getRunsback to summary
public GlyphList[] getRuns()

Returns the GlyphList of text layout. The runs are returned order visually (rendering order), starting from the first line.

Returns:GlyphList[]

the runs

getShapeback to summary
public Shape getShape(int type, TextSpan filter)

Returns the shape of the entire text layout relative to the baseline of the first line.

Parameters
type:int

the type of the shapes to include

Returns:Shape

the shape

getVisualBoundsback to summary
public BaseBounds getVisualBounds(int type)

Returns the visual bounds of the layout using glyph bounding box

Returns:BaseBounds

the visual bounds

setAlignmentback to summary
public boolean setAlignment(int alignment)

Sets the alignment for the TextLayout.

Returns:boolean

returns true is the call modifies the layout internal state.

setBoundsTypeback to summary
public boolean setBoundsType(int type)

Sets the bounds type for the TextLayout.

Returns:boolean

returns true is the call modifies the layout internal state.

setContentback to summary
public boolean setContent(TextSpan[] spans)

Sets the content for the TextLayout. Supports multiple spans (rich text).

Returns:boolean

returns true is the call modifies the layout internal state.

setContentback to summary
public boolean setContent(String string, Object font)

Sets the content for the TextLayout. Shorthand for single span text (no rich text).

Returns:boolean

returns true is the call modifies the layout internal state.

setDirectionback to summary
public boolean setDirection(int direction)

Sets the direction (bidi algorithm's) for the TextLayout.

Returns:boolean

returns true is the call modifies the layout internal state.

setLineSpacingback to summary
public boolean setLineSpacing(float spacing)

Sets the line spacing for the TextLayout.

Returns:boolean

returns true is the call modifies the layout internal state.

setTabSizeback to summary
public boolean setTabSize(int spaces)

Sets the tab size for the TextLayout.

Parameters
spaces:int

the number of spaces represented by a tab. Default is 8. Minimum is 1, lower values will be clamped to 1.

Returns:boolean

returns true if the call modifies the layout internal state.

setWrapWidthback to summary
public boolean setWrapWidth(float wrapWidth)

Sets the wrap width for the TextLayout.

Returns:boolean

returns true is the call modifies the layout internal state.

com.sun.javafx.scene.text back to summary

public Class TextLayout.Hit

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv boolean

Constructor Summary

AccessConstructor and Description
public
Hit(int charIndex, int insertionIndex, boolean leading)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
public int
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

charIndexback to summary
pack-priv int charIndex
insertionIndexback to summary
pack-priv int insertionIndex
leadingback to summary
pack-priv boolean leading

Constructor Detail

Hitback to summary
public Hit(int charIndex, int insertionIndex, boolean leading)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getCharIndexback to summary
public int getCharIndex()
getInsertionIndexback to summary
public int getInsertionIndex()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isLeadingback to summary
public boolean isLeading()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override