Class TextAreaSkin

    • Constructor Detail

      • TextAreaSkin

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

      • layoutChildren

        protected void layoutChildren​(double contentX,
                                      double contentY,
                                      double contentWidth,
                                      double contentHeight)
        Called during the layout pass of the scenegraph.
        Overrides:
        layoutChildren in class SkinBase<TextArea>
        Parameters:
        contentX - the x position
        contentY - the y position
        contentWidth - the width
        contentHeight - the height
      • getIndex

        public HitInfo getIndex​(double x,
                                double y)
        Performs a hit test, mapping point to index in the content.
        Parameters:
        x - the x coordinate of the point.
        y - the y coordinate of the point.
        Returns:
        a HitInfo object describing the index and forward bias.
      • moveCaret

        public 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.
        Specified by:
        moveCaret in class TextInputControlSkin<TextArea>
        Parameters:
        unit - the unit of text to move by.
        dir - the direction of movement.
        select - whether to extends the selection to the new posititon.
      • getUnderlineShape

        protected PathElement[] getUnderlineShape​(int start,
                                                  int end)
        Specified by:
        getUnderlineShape in class TextInputControlSkin<TextArea>
        Parameters:
        start - the start
        end - the end
        Returns:
        the path elements describing the shape of the underline for the given range.
      • getRangeShape

        protected PathElement[] getRangeShape​(int start,
                                              int end)
        Specified by:
        getRangeShape in class TextInputControlSkin<TextArea>
        Parameters:
        start - the start
        end - the end
        Returns:
        the path elements describing the bounding rectangles for the given range of text.
      • addHighlight

        protected void addHighlight​(List<? extends Node> nodes,
                                    int start)
        Adds highlight for composed text from Input Method.
        Specified by:
        addHighlight in class TextInputControlSkin<TextArea>
        Parameters:
        nodes - the list of nodes
        start - the start
      • 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.
        Overrides:
        getMenuPosition in class TextInputControlSkin<TextArea>
        Returns:
        the position to be used for this context menu
      • getCaretBounds

        public Bounds getCaretBounds()
        Gets the Bounds of the caret of the skinned TextArea.
        Returns:
        the Bounds of the caret shape, relative to the TextArea.
      • dispose

        public void dispose()
        Called by a Skinnable when the Skin is replaced on the Skinnable. This method allows a Skin to implement any logic necessary to clean up itself after the Skin is no longer needed. It may be used to release native resources. The methods Skin.getSkinnable() and Skin.getNode() should return null following a call to dispose. Calling dispose twice has no effect.
        Specified by:
        dispose in interface Skin<TextArea>
        Overrides:
        dispose in class SkinBase<TextArea>
      • computeBaselineOffset

        public double computeBaselineOffset​(double topInset,
                                            double rightInset,
                                            double bottomInset,
                                            double leftInset)
        Calculates the baseline offset based on the first managed child. If there is no such child, returns Node.getBaselineOffset().
        Overrides:
        computeBaselineOffset in class SkinBase<TextArea>
        Parameters:
        topInset - the pixel snapped top inset
        rightInset - the pixel snapped right inset
        bottomInset - the pixel snapped bottom inset
        leftInset - the pixel snapped left inset
        Returns:
        baseline offset
      • getInsertionPoint

        protected int getInsertionPoint​(double x,
                                        double y)
        Returns the insertion point for a given location.
        Overrides:
        getInsertionPoint in class TextInputControlSkin<TextArea>
        Parameters:
        x - the x location
        y - the y location
        Returns:
        the insertion point for a given location
      • positionCaret

        public void positionCaret​(HitInfo hit,
                                  boolean select)
        Moves the caret to the specified position.
        Parameters:
        hit - the new position and forward bias of the caret.
        select - whether to extend selection to the new position.
      • getCharacterBounds

        public Rectangle2D getCharacterBounds​(int index)
        Returns the bounds of the character at a given index.
        Overrides:
        getCharacterBounds in class TextInputControlSkin<TextArea>
        Parameters:
        index - the index
        Returns:
        the bounds of the character at a given index