Spec-Zone.ru › OpenJavaFX 11
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
    public abstract class TextInputControlSkin<T extends TextInputControl>
    extends SkinBase<T>
    Abstract base class for text input skins.
    Since:
    9
    See Also:
    TextFieldSkin, TextAreaSkin
  • Property Summary

    Properties
    Type Property Description
    protected BooleanProperty forwardBias
    Caret bias in the content.
    protected ObjectProperty<Paint> highlightFill
    The fill to use for the text when highlighted.
    protected ObjectProperty<Paint> highlightTextFill
    protected ObjectProperty<Paint> promptTextFill
    protected ObjectProperty<Paint> textFill
    The fill to use for the text under normal conditions
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  TextInputControlSkin.Direction
    Direction names for caret movement.
    static class  TextInputControlSkin.TextUnit
    Unit names for caret movement.
  • Constructor Summary

    Constructors
    Constructor Description
    TextInputControlSkin​(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

    All MethodsStatic MethodsInstance MethodsAbstract MethodsConcrete Methods
    Modifier and Type Method Description
    protected abstract void addHighlight​(List<? extends Node> nodes, int start)
    Adds highlight for composed text from Input Method.
    protected void executeAccessibleAction​(AccessibleAction action, Object... parameters)
    This method is called by the assistive technology to request the action indicated by the argument should be executed.
    protected BooleanProperty forwardBiasProperty()
    Caret bias in the content.
    Rectangle2D getCharacterBounds​(int index)
    Returns the bounds of the character at a given index.
    static List<CssMetaData<? extends Styleable,​?>> getClassCssMetaData()
    Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
    List<CssMetaData<? extends Styleable,​?>> getCssMetaData()
    This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.
    protected Paint getHighlightFill()
    Gets the value of the property highlightFill.
    protected Paint getHighlightTextFill()
    Gets the value of the property highlightTextFill.
    protected int getInsertionPoint​(double x, double y)
    Returns the insertion point for a given location.
    Point2D getMenuPosition()
    Returns the position to be used for a context menu, based on the location of the caret handle or selection handles.
    protected Paint getPromptTextFill()
    Gets the value of the property promptTextFill.
    protected abstract PathElement[] getRangeShape​(int start, int end)
    protected Paint getTextFill()
    Gets the value of the property textFill.
    protected abstract PathElement[] getUnderlineShape​(int start, int end)
    protected void handleInputMethodEvent​(InputMethodEvent event)
    protected ObjectProperty<Paint> highlightFillProperty()
    The fill to use for the text when highlighted.
    protected ObjectProperty<Paint> highlightTextFillProperty()
    protected void invalidateMetrics()
    Invalidates cached min and pref sizes for the TextInputControl.
    protected boolean isForwardBias()
    Gets the value of the property forwardBias.
    protected String maskText​(String txt)
    This method may be overridden by subclasses to replace the displayed characters without affecting the actual text content.
    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.
    protected ObjectProperty<Paint> promptTextFillProperty()
    protected abstract void removeHighlight​(List<? extends Node> nodes)
    Removes highlight for composed text from Input Method.
    protected void scrollCharacterToVisible​(int index)
    Ensures that the character at a given index is visible.
    void setCaretAnimating​(boolean value)
    Starts or stops caret blinking.
    void setForwardBias​(boolean isLeading)
    Sets the value of the property forwardBias.
    protected void setHighlightFill​(Paint value)
    The fill Paint used for the background of selected text.
    protected void setHighlightTextFill​(Paint value)
    The fill Paint used for the foreground of selected text.
    protected void setPromptTextFill​(Paint value)
    The fill Paint used for the foreground prompt text color.
    protected void setTextFill​(Paint value)
    The fill Paint used for the foreground text color.
    protected ObjectProperty<Paint> textFillProperty()
    The fill to use for the text under normal conditions
    protected void updateHighlightFill()
    Called when highlightFill property changes.
    protected void updateHighlightTextFill()
    Called when highlightTextFill property changes.
    protected void updateTextFill()
    Called when textFill property changes.
    • Methods inherited from class javafx.scene.control.SkinBase

      computeBaselineOffset, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, consumeMouseEvents, dispose, getChildren, getNode, getSkinnable, layoutChildren, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Detail

    • textFill

      protected final ObjectProperty<Paint> textFillProperty
      The fill to use for the text under normal conditions
      See Also:
      getTextFill(), setTextFill(Paint)
    • promptTextFill

      protected final ObjectProperty<Paint> promptTextFillProperty
      See Also:
      getPromptTextFill(), setPromptTextFill(Paint)
    • highlightFill

      protected final ObjectProperty<Paint> highlightFillProperty
      The fill to use for the text when highlighted.
      See Also:
      getHighlightFill(), setHighlightFill(Paint)
    • highlightTextFill

      protected final ObjectProperty<Paint> highlightTextFillProperty
      See Also:
      getHighlightTextFill(), setHighlightTextFill(Paint)
    • forwardBias

      protected final BooleanProperty forwardBiasProperty
      Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
      See Also:
      isForwardBias(), setForwardBias(boolean)
  • Constructor Detail

    • TextInputControlSkin

      public TextInputControlSkin​(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.
      Parameters:
      control - The control that this skin should be installed onto.
  • Method Detail

    • setTextFill

      protected final void setTextFill​(Paint value)
      The fill Paint used for the foreground text color.
      Parameters:
      value - the text fill
    • getTextFill

      protected final Paint getTextFill()
      Gets the value of the property textFill.
      Property description:
      The fill to use for the text under normal conditions
    • textFillProperty

      protected final ObjectProperty<Paint> textFillProperty()
      The fill to use for the text under normal conditions
      See Also:
      getTextFill(), setTextFill(Paint)
    • setPromptTextFill

      protected final void setPromptTextFill​(Paint value)
      The fill Paint used for the foreground prompt text color.
      Parameters:
      value - the prompt text fill
    • getPromptTextFill

      protected final Paint getPromptTextFill()
      Gets the value of the property promptTextFill.
      Property description:
    • promptTextFillProperty

      protected final ObjectProperty<Paint> promptTextFillProperty()
      See Also:
      getPromptTextFill(), setPromptTextFill(Paint)
    • setHighlightFill

      protected final void setHighlightFill​(Paint value)
      The fill Paint used for the background of selected text.
      Parameters:
      value - the highlight fill
    • getHighlightFill

      protected final Paint getHighlightFill()
      Gets the value of the property highlightFill.
      Property description:
      The fill to use for the text when highlighted.
    • highlightFillProperty

      protected final ObjectProperty<Paint> highlightFillProperty()
      The fill to use for the text when highlighted.
      See Also:
      getHighlightFill(), setHighlightFill(Paint)
    • setHighlightTextFill

      protected final void setHighlightTextFill​(Paint value)
      The fill Paint used for the foreground of selected text.
      Parameters:
      value - the highlight text fill
    • getHighlightTextFill

      protected final Paint getHighlightTextFill()
      Gets the value of the property highlightTextFill.
      Property description:
    • highlightTextFillProperty

      protected final ObjectProperty<Paint> highlightTextFillProperty()
      See Also:
      getHighlightTextFill(), setHighlightTextFill(Paint)
    • forwardBiasProperty

      protected final BooleanProperty forwardBiasProperty()
      Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
      See Also:
      isForwardBias(), setForwardBias(boolean)
    • setForwardBias

      public final void setForwardBias​(boolean isLeading)
      Sets the value of the property forwardBias.
      Property description:
      Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
    • isForwardBias

      protected final boolean isForwardBias()
      Gets the value of the property forwardBias.
      Property description:
      Caret bias in the content. true means a bias towards forward character (true=leading/false=trailing)
    • getUnderlineShape

      protected abstract PathElement[] getUnderlineShape​(int start,
                                                         int end)
      Parameters:
      start - the start
      end - the end
      Returns:
      the path elements describing the shape of the underline for the given range.
    • getRangeShape

      protected abstract PathElement[] getRangeShape​(int start,
                                                     int end)
      Parameters:
      start - the start
      end - the end
      Returns:
      the path elements describing the bounding rectangles for the given range of text.
    • addHighlight

      protected abstract void addHighlight​(List<? extends Node> nodes,
                                           int start)
      Adds highlight for composed text from Input Method.
      Parameters:
      nodes - the list of nodes
      start - the start
    • removeHighlight

      protected abstract void removeHighlight​(List<? extends Node> nodes)
      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

      public Point2D 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

      protected String maskText​(String txt)
      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 location
      y - the y location
      Returns:
      the insertion point for a given location
    • getCharacterBounds

      public Rectangle2D getCharacterBounds​(int index)
      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

      protected void handleInputMethodEvent​(InputMethodEvent event)
    • 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

      public static List<CssMetaData<? extends Styleable,​?>> 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
    • getCssMetaData

      public List<CssMetaData<? extends Styleable,​?>> getCssMetaData()
      This method should delegate to Node.getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.
      Overrides:
      getCssMetaData in class SkinBase<T extends TextInputControl>
      Returns:
      The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
    • executeAccessibleAction

      protected void executeAccessibleAction​(AccessibleAction action,
                                             Object... parameters)
      Description copied from class: SkinBase
      This method is called by the assistive technology to request the action indicated by the argument should be executed.

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

      Overrides:
      executeAccessibleAction in class SkinBase<T extends TextInputControl>
      Parameters:
      action - the action to execute
      parameters - optional list of parameters
      See Also:
      AccessibleAction, Node.executeAccessibleAction(javafx.scene.AccessibleAction, java.lang.Object...)

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API