APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javafx.scene.control.skin

public Class TextAreaSkin

extends TextInputControlSkin<TextArea>
Class Inheritance
Static Imports
com.sun.javafx.PlatformUtil.isMac, .PlatformUtil.isWindows

Default skin implementation for the TextArea control.
Since
9
See Also
TextArea

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final TextAreaBehavior
private ObservableIntegerValue
private Path
private double
private double
private double
private double
private double
private TextAreaSkin.ContentView
private boolean
private double
private Bounds
private Group
private double
private double
private Text
private VerticalDirection
private EventHandler<ScrollEvent>
private ScrollPane
private EventHandler<ActionEvent>
private Timeline
private Group
pack-priv double
targetCaretX

Remembers horizontal position when traversing up / down.

private final TextArea
private static final Path
tmpCaretPath

A shared helper object, used only by downLines().

private ObservableBooleanValue
private double
Inherited from javafx.scene.control.skin.TextInputControlSkin:
caretHandlecaretPathfontMetricsselectionHandle1selectionHandle2SHOW_HANDLES

Constructor Summary

AccessConstructor and Description
public
TextAreaSkin(final TextArea
The control that this skin should be installed onto.
control
)

Creates a new TextAreaSkin instance, installing the necessary child nodes into the Control children list, as well as the necessary input mappings for handling key, mouse, etc events.

Method Summary

Modifier and TypeMethod and Description
protected void
addHighlight(List<? extends Node> nodes, int start)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.addHighlight.

Adds highlight for composed text from Input Method.

public double
computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeBaselineOffset.

Calculates the baseline offset based on the first managed child.

private void
public void
dispose()

Overrides javafx.scene.control.skin.TextInputControlSkin.dispose.

Implements javafx.scene.control.Skin.dispose.

Called when a previously installed skin is about to be removed from its associated control.

private void
downLines(int nLines, boolean select, boolean extendSelection)

pack-priv TextAreaBehavior
public Bounds

Returns:

the Bounds of the caret shape, relative to the TextArea.
getCaretBounds
()

Gets the Bounds of the caret of the skinned TextArea.

private char
getCharacter(int index)

public Rectangle2D
getCharacterBounds(int index)

Overrides javafx.scene.control.skin.TextInputControlSkin.getCharacterBounds.

Returns the bounds of the character at a given index.

public HitInfo

Returns:

a HitInfo object describing the index and forward bias.
getIndex
(double
the x coordinate of the point.
x
,
double
the y coordinate of the point.
y
)

Performs a hit test, mapping point to index in the content.

protected int
getInsertionPoint(double x, double y)

Overrides javafx.scene.control.skin.TextInputControlSkin.getInsertionPoint.

Returns the insertion point for a given location.

public Point2D
getMenuPosition()

Overrides javafx.scene.control.skin.TextInputControlSkin.getMenuPosition.

Returns the position to be used for a context menu, based on the location of the caret handle or selection handles.

pack-priv Text
protected PathElement[]
getRangeShape(int start, int end)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.getRangeShape.

Gets the path elements describing the bounding rectangles for the given range of text.

private double
pack-priv ScrollPane
private double
pack-priv Text
private double
private double
protected PathElement[]
getUnderlineShape(int start, int end)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.getUnderlineShape.

Gets the path elements describing the shape of the underline for the given range.

private HitInfo
protected void
invalidateMetrics()

Overrides javafx.scene.control.skin.TextInputControlSkin.invalidateMetrics.

Invalidates cached min and pref sizes for the TextInputControl.

protected void
layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

private void
lineEnd(boolean select, boolean extendSelection)

private void
lineStart(boolean select, boolean extendSelection)

public void
moveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.moveCaret.

Moves the caret by one of the given text unit, in the given direction.

private void
nextCharacterVisually(boolean moveRight)

private void
nextLine(boolean select)

private void
nextPage(boolean select)

private void
paragraphEnd(boolean goPastInitialNewline, boolean select)

private void
paragraphStart(boolean previousIfAtStart, boolean select)

public void
positionCaret(HitInfo
the new position and forward bias of the caret.
hit
,
boolean
whether to extend selection to the new position.
select
)

Moves the caret to the specified position.

private void
positionCaret(int pos, boolean leading, boolean select, boolean extendSelection)

private void
previousLine(boolean select)

private void
previousPage(boolean select)

protected Object
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

protected void
removeHighlight(List<? extends Node> nodes)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.removeHighlight.

Removes highlight for composed text from Input Method.

private void
private void
protected void
scrollCharacterToVisible(final int index)

Overrides javafx.scene.control.skin.TextInputControlSkin.scrollCharacterToVisible.

Ensures that the character at a given index is visible.

pack-priv void
setHandlePressed(boolean pressed)

private void
protected void
updateHighlightFill()

Overrides javafx.scene.control.skin.TextInputControlSkin.updateHighlightFill.

Called when highlightFill property changes.

private void
private void
private void
Inherited from javafx.scene.control.skin.TextInputControlSkin:
caretVisiblePropertyexecuteAccessibleActionforwardBiasPropertygetClassCssMetaDatagetCssMetaDatagetHighlightFillgetHighlightTextFillgetPromptTextFillgetTextFillhandleInputMethodEventhighlightFillPropertyhighlightTextFillPropertyinstallisCaretBlinkingisForwardBiasisRTLmaskTextpromptTextFillPropertysetCaretAnimatingsetForwardBiassetHighlightFillsetHighlightTextFillsetPromptTextFillsetTextFilltextFillPropertyupdateHighlightTextFillupdateTextFill

Field Detail

behaviorback to summary
private final TextAreaBehavior behavior
caretPositionback to summary
private ObservableIntegerValue caretPosition
characterBoundingPathback to summary
private Path characterBoundingPath
characterWidthback to summary
private double characterWidth
computedMinHeightback to summary
private double computedMinHeight
computedMinWidthback to summary
private double computedMinWidth
computedPrefHeightback to summary
private double computedPrefHeight
computedPrefWidthback to summary
private double computedPrefWidth
contentViewback to summary
private TextAreaSkin.ContentView contentView
handlePressedback to summary
private boolean handlePressed
lineHeightback to summary
private double lineHeight
oldViewportBoundsback to summary
private Bounds oldViewportBounds
paragraphNodesback to summary
private Group paragraphNodes
pressXback to summary
private double pressX
pressYback to summary
private double pressY
promptNodeback to summary
private Text promptNode
scrollDirectionback to summary
private VerticalDirection scrollDirection
scrollEventFilterback to summary
private EventHandler<ScrollEvent> scrollEventFilter
scrollPaneback to summary
private ScrollPane scrollPane
scrollSelectionHandlerback to summary
private EventHandler<ActionEvent> scrollSelectionHandler
scrollSelectionTimelineback to summary
private Timeline scrollSelectionTimeline
selectionHighlightGroupback to summary
private Group selectionHighlightGroup
targetCaretXback to summary
pack-priv double targetCaretX

Remembers horizontal position when traversing up / down.

textAreaback to summary
private final TextArea textArea
tmpCaretPathback to summary
private static final Path tmpCaretPath

A shared helper object, used only by downLines().

usePromptTextback to summary
private ObservableBooleanValue usePromptText
widthForComputedPrefHeightback to summary
private double widthForComputedPrefHeight

Constructor Detail

TextAreaSkinback to summary
public TextAreaSkin(final TextArea control)

Creates a new TextAreaSkin instance, installing the necessary child nodes into the Control children list, as well as the necessary input mappings for handling key, mouse, etc events.

Parameters
control:TextArea

The control that this skin should be installed onto.

Method Detail

addHighlightback to summary
protected void addHighlight(List<? extends Node> nodes, int start)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.addHighlight.

Doc from javafx.scene.control.skin.TextInputControlSkin.addHighlight.

Adds highlight for composed text from Input Method.

Annotations
@Override
computeBaselineOffsetback to summary
public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeBaselineOffset.

Doc from javafx.scene.control.SkinBase.computeBaselineOffset.

Calculates the baseline offset based on the first managed child. If there is no such child, returns Node#getBaselineOffset().

Annotations
@Override
createPromptNodeback to summary
private void createPromptNode()
disposeback to summary
public void dispose()

Overrides javafx.scene.control.skin.TextInputControlSkin.dispose.

Implements javafx.scene.control.Skin.dispose.

Doc from javafx.scene.control.SkinBase.dispose.

Called when a previously installed skin is about to be removed from its associated control. This allows the skin to do clean up, like removing listeners and bindings, and undo any changes to the control's properties. After this method completes, getSkinnable() and getNode() should return null.

Calling dispose() more than once has no effect.

Annotations
@Override
downLinesback to summary
private void downLines(int nLines, boolean select, boolean extendSelection)
getBehaviorback to summary
pack-priv TextAreaBehavior getBehavior()

Overrides javafx.scene.control.skin.TextInputControlSkin.getBehavior.

Annotations
@Override
getCaretBoundsback to summary
public Bounds getCaretBounds()

Gets the Bounds of the caret of the skinned TextArea.

Returns:Bounds

the Bounds of the caret shape, relative to the TextArea.

getCharacterback to summary
private char getCharacter(int index)
getCharacterBoundsback to summary
public Rectangle2D getCharacterBounds(int index)

Overrides javafx.scene.control.skin.TextInputControlSkin.getCharacterBounds.

Doc from javafx.scene.control.skin.TextInputControlSkin.getCharacterBounds.

Returns the bounds of the character at a given index.

Annotations
@Override
getIndexback to summary
public HitInfo getIndex(double x, double y)

Performs a hit test, mapping point to index in the content.

Parameters
x:double

the x coordinate of the point.

y:double

the y coordinate of the point.

Returns:HitInfo

a HitInfo object describing the index and forward bias.

getInsertionPointback to summary
protected int getInsertionPoint(double x, double y)

Overrides javafx.scene.control.skin.TextInputControlSkin.getInsertionPoint.

Doc from javafx.scene.control.skin.TextInputControlSkin.getInsertionPoint.

Returns the insertion point for a given location.

Annotations
@Override
getMenuPositionback to summary
public Point2D getMenuPosition()

Overrides javafx.scene.control.skin.TextInputControlSkin.getMenuPosition.

Doc from javafx.scene.control.skin.TextInputControlSkin.getMenuPosition.

Returns the position to be used for a context menu, based on the location of the caret handle or selection handles. This is supported only on touch displays and does not use the location of the mouse.

Annotations
@Override
getPromptNodeback to summary
pack-priv Text getPromptNode()
getRangeShapeback to summary
protected PathElement[] getRangeShape(int start, int end)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.getRangeShape.

Doc from javafx.scene.control.skin.TextInputControlSkin.getRangeShape.

Gets the path elements describing the bounding rectangles for the given range of text.

Annotations
@Override
getScrollLeftMaxback to summary
private double getScrollLeftMax()
getScrollPaneback to summary
pack-priv ScrollPane getScrollPane()
getScrollTopMaxback to summary
private double getScrollTopMax()
getTextNodeback to summary
pack-priv Text getTextNode()
getTextTranslateXback to summary
private double getTextTranslateX()
getTextTranslateYback to summary
private double getTextTranslateY()
getUnderlineShapeback to summary
protected PathElement[] getUnderlineShape(int start, int end)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.getUnderlineShape.

Doc from javafx.scene.control.skin.TextInputControlSkin.getUnderlineShape.

Gets the path elements describing the shape of the underline for the given range.

Annotations
@Override
hitTestback to summary
private HitInfo hitTest(Point2D p)
invalidateMetricsback to summary
protected void invalidateMetrics()

Overrides javafx.scene.control.skin.TextInputControlSkin.invalidateMetrics.

Doc from javafx.scene.control.skin.TextInputControlSkin.invalidateMetrics.

Invalidates cached min and pref sizes for the TextInputControl.

Annotations
@Override
layoutChildrenback to summary
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Doc from javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

Annotations
@Override
lineEndback to summary
private void lineEnd(boolean select, boolean extendSelection)
lineStartback to summary
private void lineStart(boolean select, boolean extendSelection)
moveCaretback to summary
public void moveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.moveCaret.

Doc from javafx.scene.control.skin.TextInputControlSkin.moveCaret.

Moves the caret by one of the given text unit, in the given direction. Note that only certain combinations are valid, depending on the implementing subclass.

Annotations
@Override
nextCharacterVisuallyback to summary
private void nextCharacterVisually(boolean moveRight)
nextLineback to summary
private void nextLine(boolean select)
nextPageback to summary
private void nextPage(boolean select)
paragraphEndback to summary
private void paragraphEnd(boolean goPastInitialNewline, boolean select)
paragraphStartback to summary
private void paragraphStart(boolean previousIfAtStart, boolean select)
positionCaretback to summary
public void positionCaret(HitInfo hit, boolean select)

Moves the caret to the specified position.

Parameters
hit:HitInfo

the new position and forward bias of the caret.

select:boolean

whether to extend selection to the new position.

positionCaretback to summary
private void positionCaret(int pos, boolean leading, boolean select, boolean extendSelection)
previousLineback to summary
private void previousLine(boolean select)
previousPageback to summary
private void previousPage(boolean select)
queryAccessibleAttributeback to summary
protected Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

Doc from javafx.scene.control.SkinBase.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
If a particular attribute is not handled, the superclass implementation must be called.

Annotations
@Override
removeHighlightback to summary
protected void removeHighlight(List<? extends Node> nodes)

Implements abstract javafx.scene.control.skin.TextInputControlSkin.removeHighlight.

Doc from javafx.scene.control.skin.TextInputControlSkin.removeHighlight.

Removes highlight for composed text from Input Method.

Annotations
@Override
scrollBoundsToVisibleback to summary
private void scrollBoundsToVisible(Rectangle2D bounds)
scrollCaretToVisibleback to summary
private void scrollCaretToVisible()
scrollCharacterToVisibleback to summary
protected void scrollCharacterToVisible(final int index)

Overrides javafx.scene.control.skin.TextInputControlSkin.scrollCharacterToVisible.

Doc from javafx.scene.control.skin.TextInputControlSkin.scrollCharacterToVisible.

Ensures that the character at a given index is visible.

Annotations
@Override
setHandlePressedback to summary
pack-priv void setHandlePressed(boolean pressed)
updateFontMetricsback to summary
private void updateFontMetrics()
updateHighlightFillback to summary
protected void updateHighlightFill()

Overrides javafx.scene.control.skin.TextInputControlSkin.updateHighlightFill.

Doc from javafx.scene.control.skin.TextInputControlSkin.updateHighlightFill.

Called when highlightFill property changes.

Annotations
@Override
updatePrefViewportHeightback to summary
private void updatePrefViewportHeight()
updatePrefViewportWidthback to summary
private void updatePrefViewportWidth()
updateTextNodeCaretPosback to summary
private void updateTextNodeCaretPos(int pos)
javafx.scene.control.skin back to summary

private Class TextAreaSkin.ContentView

extends Region
Class Inheritance

Field Summary

Inherited from javafx.scene.layout.Region:
USE_COMPUTED_SIZEUSE_PREF_SIZE

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected double
computeMinHeight(double width)

Overrides javafx.scene.layout.Region.computeMinHeight.

Computes the minimum height of this region.

protected double
computeMinWidth(double height)

Overrides javafx.scene.layout.Region.computeMinWidth.

Computes the minimum width of this region.

protected double
computePrefHeight(double width)

Overrides javafx.scene.layout.Region.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy.

protected double
computePrefWidth(double height)

Overrides javafx.scene.layout.Region.computePrefWidth.

Computes the preferred width of this region for the given height.

protected ObservableList<Node>
getChildren()

Overrides javafx.scene.Parent.getChildren.

Gets the list of children of this Parent.

public Orientation
getContentBias()

Overrides javafx.scene.Node.getContentBias.

Returns the orientation of a node's resizing bias for layout purposes.

public void
layoutChildren()

Overrides javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

Inherited from javafx.scene.layout.Region:
backgroundPropertyborderPropertycacheShapePropertycenterShapePropertycomputeMaxHeightcomputeMaxWidthgetBackgroundgetBordergetClassCssMetaDatagetCssMetaDatagetHeightgetInsetsgetMaxHeightgetMaxWidthgetMinHeightgetMinWidthgetOpaqueInsetsgetPaddinggetPrefHeightgetPrefWidthgetShapegetUserAgentStylesheetgetWidthheightPropertyinsetsPropertyisCacheShapeisCenterShapeisResizableisScaleShapeisSnapToPixellayoutInArealayoutInArealayoutInArealayoutInAreamaxHeightmaxHeightPropertymaxWidthmaxWidthPropertyminHeightminHeightPropertyminWidthminWidthPropertyopaqueInsetsPropertypaddingPropertypositionInAreapositionInAreaprefHeightprefHeightPropertyprefWidthprefWidthPropertyresizescaleShapePropertysetBackgroundsetBordersetCacheShapesetCenterShapesetHeightsetMaxHeightsetMaxSizesetMaxWidthsetMinHeightsetMinSizesetMinWidthsetOpaqueInsetssetPaddingsetPrefHeightsetPrefSizesetPrefWidthsetScaleShapesetShapesetSnapToPixelsetWidthshapePropertysnappedBottomInsetsnappedLeftInsetsnappedRightInsetsnappedTopInsetsnapPositionsnapPositionXsnapPositionYsnapSizesnapSizeXsnapSizeYsnapSpacesnapSpaceXsnapSpaceYsnapToPixelPropertywidthProperty

Constructor Detail

ContentViewback to summary
private ContentView()

Method Detail

computeMinHeightback to summary
protected double computeMinHeight(double width)

Overrides javafx.scene.layout.Region.computeMinHeight.

Doc from javafx.scene.layout.Region.computeMinHeight.

Computes the minimum height of this region. Returns the sum of the top and bottom insets by default. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Annotations
@Override
computeMinWidthback to summary
protected double computeMinWidth(double height)

Overrides javafx.scene.layout.Region.computeMinWidth.

Doc from javafx.scene.layout.Region.computeMinWidth.

Computes the minimum width of this region. Returns the sum of the left and right insets by default. region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a VERTICAL content bias, then the height parameter can be ignored.

Annotations
@Override
computePrefHeightback to summary
protected double computePrefHeight(double width)

Overrides javafx.scene.layout.Region.computePrefHeight.

Doc from javafx.scene.layout.Region.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double height)

Overrides javafx.scene.layout.Region.computePrefWidth.

Doc from javafx.scene.layout.Region.computePrefWidth.

Computes the preferred width of this region for the given height. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a VERTICAL content bias, then the height parameter can be ignored.

Annotations
@Override
getChildrenback to summary
protected ObservableList<Node> getChildren()

Overrides javafx.scene.Parent.getChildren.

Doc from javafx.scene.Parent.getChildren.

Gets the list of children of this Parent.

See the class documentation for Node for scene graph structure restrictions on setting a Parent's children list. If these restrictions are violated by a change to the list of children, the change is ignored and the previous value of the children list is restored. An IllegalArgumentException is thrown in this case.

If this Parent node is attached to a Scene attached to a Window, that is, showing (javafx.stage.Window#isShowing()), then its list of children must only be modified on the JavaFX Application Thread. An IllegalStateException is thrown if this restriction is violated.

Note to subclasses: if you override this method, you must return from your implementation the result of calling this super method. The actual list instance returned from any getChildren() implementation must be the list owned and managed by this Parent. The only typical purpose for overriding this method is to promote the method to be public.

Annotations
@Override
getContentBiasback to summary
public Orientation getContentBias()

Overrides javafx.scene.Node.getContentBias.

Doc from javafx.scene.Node.getContentBias.

Returns the orientation of a node's resizing bias for layout purposes. If the node type has no bias, returns null. If the node is resizable and it's height depends on its width, returns HORIZONTAL, else if its width depends on its height, returns VERTICAL.

Resizable subclasses should override this method to return an appropriate value.

Annotations
@Override
layoutChildrenback to summary
public void layoutChildren()

Overrides javafx.scene.Parent.layoutChildren.

Doc from javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent. By default it will only set the size of managed, resizable content to their preferred sizes and does not do any node positioning.

Subclasses should override this function to layout content as needed.

Annotations
@Override