Module javafx.controls
Package javafx.scene.control.skin
Class TextInputControlSkin<T extends TextInputControl>
java.lang.Object
javafx.scene.control.SkinBase<T>
javafx.scene.control.skin.TextInputControlSkin<T>
- All Implemented Interfaces:
Skin<T>
- Direct Known Subclasses:
TextAreaSkin,TextFieldSkin
Abstract base class for text input skins.
- Since:
- 9
- See Also:
-
Property Summary
PropertiesTypePropertyDescriptionprotected final BooleanPropertyCaret bias in the content.protected final ObjectProperty<Paint>The fill to use for the text when highlighted.protected final ObjectProperty<Paint>The fillPaintused for the foreground of selected text.protected final ObjectProperty<Paint>The fillPaintused for the foreground of prompt text.protected final ObjectProperty<Paint>The fill to use for the text under normal conditions -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDirection names for caret movement.static enumUnit names for caret movement. -
Constructor Summary
ConstructorsConstructorDescriptionTextInputControlSkin(T control) Creates a new instance of TextInputControlSkin, although note that this instance does not handle any behavior / input mappings - this needs to be handled appropriately by subclasses. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddHighlight(List<? extends Node> nodes, int start) Adds highlight for composed text from Input Method.protected final BooleanPropertyCaret bias in the content.getCharacterBounds(int index) Returns the bounds of the character at a given index.static List<CssMetaData<? extends Styleable,?>> Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.protected final PaintGets the value of thehighlightFillproperty.protected final PaintGets the value of thehighlightTextFillproperty.protected intgetInsertionPoint(double x, double y) Returns the insertion point for a given location.Returns the position to be used for a context menu, based on the location of the caret handle or selection handles.protected final PaintGets the value of thepromptTextFillproperty.protected abstract PathElement[]getRangeShape(int start, int end) Gets the path elements describing the bounding rectangles for the given range of text.protected final PaintGets the value of thetextFillproperty.protected abstract PathElement[]getUnderlineShape(int start, int end) Gets the path elements describing the shape of the underline for the given range.protected voidHandles an input method event.protected final ObjectProperty<Paint>The fill to use for the text when highlighted.protected final ObjectProperty<Paint>The fillPaintused for the foreground of selected text.protected voidInvalidates cached min and pref sizes for the TextInputControl.protected final booleanGets the value of theforwardBiasproperty.protected StringThis method may be overridden by subclasses to replace the displayed characters without affecting the actual text content.abstract voidmoveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select) Moves the caret by one of the given text unit, in the given direction.protected final ObjectProperty<Paint>The fillPaintused for the foreground of prompt text.protected abstract voidremoveHighlight(List<? extends Node> nodes) Removes highlight for composed text from Input Method.protected voidscrollCharacterToVisible(int index) Ensures that the character at a given index is visible.voidsetCaretAnimating(boolean value) Starts or stops caret blinking.final voidsetForwardBias(boolean isLeading) Sets the value of theforwardBiasproperty.protected final voidsetHighlightFill(Paint value) The fillPaintused for the background of selected text.protected final voidsetHighlightTextFill(Paint value) The fillPaintused for the foreground of selected text.protected final voidsetPromptTextFill(Paint value) The fillPaintused for the foreground prompt text color.protected final voidsetTextFill(Paint value) The fillPaintused for the foreground text color.protected final ObjectProperty<Paint>The fill to use for the text under normal conditionsprotected voidCalled when highlightFill property changes.protected voidCalled when highlightTextFill property changes.protected voidCalled when textFill property changes.Methods declared in class javafx.scene.control.SkinBase
computeBaselineOffset, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, consumeMouseEvents, dispose, executeAccessibleAction, getChildren, getCssMetaData, getNode, getSkinnable, layoutChildren, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, registerInvalidationListener, registerListChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners, unregisterInvalidationListeners, unregisterListChangeListeners
-
Property Details
-
textFill
The fill to use for the text under normal conditions -
promptTextFill
The fillPaintused for the foreground of prompt text. -
highlightFill
The fill to use for the text when highlighted. -
highlightTextFill
The fillPaintused for the foreground of selected text. -
forwardBias
Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
-
-
Constructor Details
-
TextInputControlSkin
Creates a new instance of TextInputControlSkin, although note that this instance does not handle any behavior / input mappings - this needs to be handled appropriately by subclasses.- Parameters:
control- The control that this skin should be installed onto.
-
-
Method Details
-
setTextFill
The fillPaintused for the foreground text color.- Parameters:
value- the text fill
-
getTextFill
Gets the value of thetextFillproperty.- Property description:
- The fill to use for the text under normal conditions
- Returns:
- the value of the
textFillproperty - See Also:
-
textFillProperty
The fill to use for the text under normal conditions- Returns:
- the
textFillproperty - See Also:
-
setPromptTextFill
The fillPaintused for the foreground prompt text color.- Parameters:
value- the prompt text fill
-
getPromptTextFill
Gets the value of thepromptTextFillproperty.- Property description:
- The fill
Paintused for the foreground of prompt text. - Returns:
- the value of the
promptTextFillproperty - See Also:
-
promptTextFillProperty
The fillPaintused for the foreground of prompt text.- Returns:
- the
promptTextFillproperty - See Also:
-
setHighlightFill
The fillPaintused for the background of selected text.- Parameters:
value- the highlight fill
-
getHighlightFill
Gets the value of thehighlightFillproperty.- Property description:
- The fill to use for the text when highlighted.
- Returns:
- the value of the
highlightFillproperty - See Also:
-
highlightFillProperty
The fill to use for the text when highlighted.- Returns:
- the
highlightFillproperty - See Also:
-
setHighlightTextFill
The fillPaintused for the foreground of selected text.- Parameters:
value- the highlight text fill
-
getHighlightTextFill
Gets the value of thehighlightTextFillproperty.- Property description:
- The fill
Paintused for the foreground of selected text. - Returns:
- the value of the
highlightTextFillproperty - See Also:
-
highlightTextFillProperty
The fillPaintused for the foreground of selected text.- Returns:
- the
highlightTextFillproperty - See Also:
-
forwardBiasProperty
Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)- Returns:
- the
forwardBiasproperty - See Also:
-
setForwardBias
public final void setForwardBias(boolean isLeading) Sets the value of theforwardBiasproperty.- Property description:
- Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
- Parameters:
isLeading- the value for theforwardBiasproperty- See Also:
-
isForwardBias
protected final boolean isForwardBias()Gets the value of theforwardBiasproperty.- Property description:
- Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
- Returns:
- the value of the
forwardBiasproperty - See Also:
-
getUnderlineShape
Gets the path elements describing the shape of the underline for the given range.- Parameters:
start- the startend- the end- Returns:
- the path elements describing the shape of the underline for the given range
-
getRangeShape
Gets the path elements describing the bounding rectangles for the given range of text.- Parameters:
start- the startend- the end- Returns:
- the path elements describing the bounding rectangles for the given range of text
-
addHighlight
Adds highlight for composed text from Input Method.- Parameters:
nodes- the list of nodesstart- the start
-
removeHighlight
Removes highlight for composed text from Input Method.- Parameters:
nodes- the list of nodes
-
moveCaret
public abstract void moveCaret(TextInputControlSkin.TextUnit unit, TextInputControlSkin.Direction dir, boolean select) 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.- Parameters:
unit- the unit of text to move by.dir- the direction of movement.select- whether to extends the selection to the new posititon.
-
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.- Returns:
- the position to be used for this context menu
-
maskText
This method may be overridden by subclasses to replace the displayed characters without affecting the actual text content. This is used to display bullet characters in PasswordField.- Parameters:
txt- the content that may need to be masked.- Returns:
- the replacement string. This may just be the input string, or may be a string of replacement characters with the same length as the input string.
-
getInsertionPoint
protected int getInsertionPoint(double x, double y) Returns the insertion point for a given location.- Parameters:
x- the x locationy- the y location- Returns:
- the insertion point for a given location
-
getCharacterBounds
Returns the bounds of the character at a given index.- Parameters:
index- the index- Returns:
- the bounds of the character at a given index
-
scrollCharacterToVisible
protected void scrollCharacterToVisible(int index) Ensures that the character at a given index is visible.- Parameters:
index- the index
-
invalidateMetrics
protected void invalidateMetrics()Invalidates cached min and pref sizes for the TextInputControl. -
updateTextFill
protected void updateTextFill()Called when textFill property changes. -
updateHighlightFill
protected void updateHighlightFill()Called when highlightFill property changes. -
updateHighlightTextFill
protected void updateHighlightTextFill()Called when highlightTextFill property changes. -
handleInputMethodEvent
Handles an input method event.- Parameters:
event- theInputMethodEventto be handled
-
setCaretAnimating
public void setCaretAnimating(boolean value) Starts or stops caret blinking. The behavior classes use this to temporarily pause blinking while user is typing or otherwise moving the caret.- Parameters:
value- whether caret should be blinking.
-
getClassCssMetaData
Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.- Returns:
- the CssMetaData associated with this class, which may include the CssMetaData of its superclasses
-