TextField control.
TextField
| Modifier and Type | Field and Description |
|---|---|
| private final TextFieldBehavior | |
| pack-priv static final char | |
| private double | |
| private Path | |
| private Rectangle | clip
The clip, applied to the textGroup. |
| private Group | |
| private double | |
| private double | |
| private Text | promptNode
The node used for showing the prompt text. |
| private Path | selectionHighlightPath
A path, provided by the textNode, which represents the area which is selected. |
| private Pane | textGroup
This group contains the text, caret, and selection rectangle. |
| private Text | textNode
The node actually displaying the text. |
| private ObservableDoubleValue | textRight
Right edge of the text region sans padding |
| private DoubleProperty | |
| private ObservableBooleanValue |
| Access | Constructor and Description |
|---|---|
| public | TextFieldSkin(final TextField
The control that this skin should be installed onto. control)Creates a new TextFieldSkin instance, installing the necessary child
nodes into the Control |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addHighlight(List<? extends Node>
the list of nodes nodes, int the start start)Implements abstract javafx. Adds highlight for composed text from Input Method. |
| public double | computeBaselineOffset(double
the pixel snapped top inset topInset, double the pixel snapped right inset rightInset, double the pixel snapped bottom inset bottomInset, double the pixel snapped left inset leftInset)Overrides javafx. Calculates the baseline offset based on the first managed child. |
| protected double | computeMaxHeight(double
The width of the Skin, in case this value might dictate
the maximum height. width, double the pixel snapped top inset topInset, double the pixel snapped right inset rightInset, double the pixel snapped bottom inset bottomInset, double the pixel snapped left inset leftInset)Overrides javafx. Computes the maximum allowable height of the Skin, based on the provided width. |
| protected double | computeMinHeight(double
The width of the Skin, in case this value might dictate
the minimum height. width, double the pixel snapped top inset topInset, double the pixel snapped right inset rightInset, double the pixel snapped bottom inset bottomInset, double the pixel snapped left inset leftInset)Overrides javafx. Computes the minimum allowable height of the Skin, based on the provided width. |
| protected double | computePrefHeight(double
the width that should be used if preferred height depends on it width, double the pixel snapped top inset topInset, double the pixel snapped right inset rightInset, double the pixel snapped bottom inset bottomInset, double the pixel snapped left inset leftInset)Overrides javafx. Calculates the preferred height of this |
| protected double | computePrefWidth(double
the height that should be used if preferred width depends on it height, double the pixel snapped top inset topInset, double the pixel snapped right inset rightInset, double the pixel snapped bottom inset bottomInset, double the pixel snapped left inset leftInset)Overrides javafx. Calculates the preferred width of this |
| private void | |
| public void | deleteChar(boolean
whether to delete the preceding character. previous)Deletes the character that follows or precedes the current caret position from the text if there is no selection, or deletes the selection if there is one. |
| public void | dispose()
Overrides javafx. Implements javafx. Called when a previously installed skin is about to be removed from its associated control. |
| pack-priv TextInputControlBehavior | |
| public Rectangle2D | getCharacterBounds(int
the index index)Overrides javafx. Returns the bounds of the character at a given index. |
| private HPos | |
| public HitInfo | Returns: aHitInfo object describing the index and forward bias.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. |
| public Point2D | getMenuPosition()
Overrides javafx. 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
the start start, int the end end)Implements abstract javafx. Gets the path elements describing the bounding rectangles for the given range of text. |
| pack-priv Text | |
| pack-priv double | |
| protected PathElement[] | getUnderlineShape(int
the start start, int the end end)Implements abstract javafx. Gets the path elements describing the shape of the underline for the given range. |
| private final HitInfo | |
| protected void | layoutChildren(final double
the x position x, final double the y position y, final double the width w, final double the height h)Overrides javafx. Called during the layout pass of the scenegraph. |
| protected String | maskText(String
the content that may need to be masked. txt)Overrides javafx. This method may be overridden by subclasses to replace the displayed characters without affecting the actual text content. |
| public void | moveCaret(TextInputControlSkin.
the unit of text to move by. unit,the direction of movement. dir,whether to extends the selection to the new position. select)Implements abstract javafx. Moves the caret by one of the given text unit, in the given direction. |
| private void | |
| 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 | |
| protected Object | queryAccessibleAttribute(AccessibleAttribute
the requested attribute attribute, Object... optional list of parameters parameters)Overrides javafx. This method is called by the assistive technology to request the value for an attribute. |
| protected void | removeHighlight(List<? extends Node>
the list of nodes nodes)Implements abstract javafx. Removes highlight for composed text from Input Method. |
| public void | replaceText(int
The starting index in the range, inclusive. This must be >= 0 and < the end. start, int The ending index in the range, exclusive. This is one-past the last character to
delete (consistent with the String manipulation methods). This must be > the start,
and <= the length of the text. end, String The text that is to replace the range. This must not be null. txt)Replaces a range of characters with the given text. |
| private void | |
| private void | |
| private void | |
| private void | |
| private void |
| behavior | back to summary |
|---|---|
| private final TextFieldBehavior behavior | |
| BULLET | back to summary |
|---|---|
| pack-priv static final char BULLET | |
| caretWidth | back to summary |
|---|---|
| private double caretWidth | |
| characterBoundingPath | back to summary |
|---|---|
| private Path characterBoundingPath | |
| clip | back to summary |
|---|---|
| private Rectangle clip The clip, applied to the textGroup. This makes sure that any text / selection wandering off the text box is clipped | |
| handleGroup | back to summary |
|---|---|
| private Group handleGroup | |
| pressX | back to summary |
|---|---|
| private double pressX | |
| pressY | back to summary |
|---|---|
| private double pressY | |
| promptNode | back to summary |
|---|---|
| private Text promptNode The node used for showing the prompt text. | |
| selectionHighlightPath | back to summary |
|---|---|
| private Path selectionHighlightPath A path, provided by the textNode, which represents the area which is selected. The path elements which make up the selection must be updated whenever the selection changes. We don't need to keep track of text changes because those will force the selection to be updated. | |
| textGroup | back to summary |
|---|---|
| private Pane textGroup This group contains the text, caret, and selection rectangle. It is clipped. The textNode, selectionHighlightPath, and caret are each translated individually when horizontal translation is needed to keep the caretPosition visible. | |
| textNode | back to summary |
|---|---|
| private Text textNode The node actually displaying the text. Note that it has the ability to render both the normal fill as well as the highlight fill, to perform hit testing, fetching of the selection highlight, and other such duties. | |
| textRight | back to summary |
|---|---|
| private ObservableDoubleValue textRight Right edge of the text region sans padding | |
| textTranslateX | back to summary |
|---|---|
| private DoubleProperty textTranslateX | |
| usePromptText | back to summary |
|---|---|
| private ObservableBooleanValue usePromptText | |
| TextFieldSkin | back to summary |
|---|---|
| public TextFieldSkin(final TextField control) Creates a new TextFieldSkin instance, installing the necessary child
nodes into the Control
| |
| addHighlight | back to summary |
|---|---|
| protected void addHighlight(List<? extends Node> nodes, int start) Implements abstract javafx. Doc from javafx. Adds highlight for composed text from Input Method. | |
| computeBaselineOffset | back to summary |
|---|---|
| public double computeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) Overrides javafx. Doc from javafx. Calculates the baseline offset based on the first managed child. If there
is no such child, returns
| |
| computeMaxHeight | back to summary |
|---|---|
| protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Overrides javafx. Doc from javafx. Computes the maximum allowable height of the Skin, based on the provided width.
| |
| computeMinHeight | back to summary |
|---|---|
| protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Overrides javafx. Doc from javafx. Computes the minimum allowable height of the Skin, based on the provided width.
| |
| computePrefHeight | back to summary |
|---|---|
| protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Overrides javafx. Doc from javafx. Calculates the preferred height of this
| |
| computePrefWidth | back to summary |
|---|---|
| protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Overrides javafx. Doc from javafx. Calculates the preferred width of this
| |
| createPromptNode | back to summary |
|---|---|
| private void createPromptNode() | |
| deleteChar | back to summary |
|---|---|
| public void deleteChar(boolean previous) Deletes the character that follows or precedes the current caret position from the text if there is no selection, or deletes the selection if there is one. Call this implementation from behavior classes instead of the one provided on TextInputControl to ensure that the text scrolls as needed.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides javafx. Implements javafx. Doc from javafx. 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,
Calling
| |
| getBehavior | back to summary |
|---|---|
| pack-priv TextInputControlBehavior Overrides javafx.
| |
| getCharacterBounds | back to summary |
|---|---|
| public Rectangle2D getCharacterBounds(int index) Overrides javafx. Doc from javafx. Returns the bounds of the character at a given index.
| |
| getHAlignment | back to summary |
|---|---|
| private HPos getHAlignment() | |
| getIndex | back to summary |
|---|---|
| public HitInfo getIndex(double x, double y) Performs a hit test, mapping point to index in the content.
| |
| getMenuPosition | back to summary |
|---|---|
| public Point2D getMenuPosition() Overrides javafx. Doc from javafx. 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. | |
| getPromptNode | back to summary |
|---|---|
| pack-priv Text getPromptNode() | |
| getRangeShape | back to summary |
|---|---|
| protected PathElement[] getRangeShape(int start, int end) Implements abstract javafx. Doc from javafx. Gets the path elements describing the bounding rectangles for the given range of text.
| |
| getTextNode | back to summary |
|---|---|
| pack-priv Text getTextNode() | |
| getTextTranslateX | back to summary |
|---|---|
| pack-priv double getTextTranslateX() | |
| getUnderlineShape | back to summary |
|---|---|
| protected PathElement[] getUnderlineShape(int start, int end) Implements abstract javafx. Doc from javafx. Gets the path elements describing the shape of the underline for the given range.
| |
| hitTest | back to summary |
|---|---|
| private final HitInfo hitTest(Point2D p) | |
| layoutChildren | back to summary |
|---|---|
| protected void layoutChildren(final double x, final double y, final double w, final double h) Overrides javafx. Doc from javafx. Called during the layout pass of the scenegraph.
| |
| maskText | back to summary |
|---|---|
| protected String maskText(String txt) Overrides javafx. Doc from javafx. 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. | |
| moveCaret | back to summary |
|---|---|
| public void moveCaret(TextInputControlSkin. Implements abstract javafx. Doc from javafx. 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.
| |
| nextCharacterVisually | back to summary |
|---|---|
| private void nextCharacterVisually(boolean moveRight) | |
| positionCaret | back to summary |
|---|---|
| public void positionCaret(HitInfo hit, boolean select) Moves the caret to the specified position.
| |
| positionCaret | back to summary |
|---|---|
| private void positionCaret(int pos, boolean leading, boolean select) | |
| queryAccessibleAttribute | back to summary |
|---|---|
| protected Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) Overrides javafx. Doc from javafx. 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.
| |
| removeHighlight | back to summary |
|---|---|
| protected void removeHighlight(List<? extends Node> nodes) Implements abstract javafx. Doc from javafx. Removes highlight for composed text from Input Method. | |
| replaceText | back to summary |
|---|---|
| public void replaceText(int start, int end, String txt) Replaces a range of characters with the given text. Call this implementation from behavior classes instead of the one provided on TextInputControl to ensure that the text scrolls as needed.
| |
| scrollAfterDelete | back to summary |
|---|---|
| private void scrollAfterDelete(double textMaxXOld, double caretMaxXOld) | |
| updateCaretOff | back to summary |
|---|---|
| private void updateCaretOff() | |
| updateSelection | back to summary |
|---|---|
| private void updateSelection() | |
| updateTextNodeCaretPos | back to summary |
|---|---|
| private void updateTextNodeCaretPos(int pos) | |
| updateTextPos | back to summary |
|---|---|
| private void updateTextPos() Updates the textTranslateX value for the Text node position. This is done for general layout, but care is taken to avoid resetting the position when there's a need to scroll the text due to caret movement, or when editing text that overflows on either side. | |