JavaScript is disabled on your browser.
JavaFX 2.2
javafx.scene.control

Class TextInputControl

    • Property Detail

      • anchor

        public final ReadOnlyIntegerProperty anchorProperty
        The anchor of the text selection. The anchor and caretPosition make up the selection range. Selection must always be specified in terms of begin <= end, but anchor may be less than, equal to, or greater than the caretPosition. Depending on how the user selects text, the anchor might represent the lower or upper bound of the selection.
        See Also:
        getAnchor()
      • caretPosition

        public final ReadOnlyIntegerProperty caretPositionProperty
        The current position of the caret within the text. The anchor and caretPosition make up the selection range. Selection must always be specified in terms of begin <= end, but anchor may be less than, equal to, or greater than the caretPosition. Depending on how the user selects text, the caretPosition might represent the lower or upper bound of the selection.
        See Also:
        getCaretPosition()
    • Constructor Detail

      • TextInputControl

        protected TextInputControl(TextInputControl.Content content)
        Creates a new TextInputControl. The content is an immutable property and must be specified (as non-null) at the time of construction.
        Parameters:
        content - a non-null implementation of Content.
    • Method Detail

      • getPromptText

        public final java.lang.String getPromptText()
        Gets the value of the property promptText.
        Property description:
        The prompt text to display in the TextInputControl, or null if no prompt text is displayed.
      • setPromptText

        public final void setPromptText(java.lang.String value)
        Sets the value of the property promptText.
        Property description:
        The prompt text to display in the TextInputControl, or null if no prompt text is displayed.
      • getText

        public final java.lang.String getText()
        Gets the value of the property text.
        Property description:
        The textual content of this TextInputControl.
      • setText

        public final void setText(java.lang.String value)
        Sets the value of the property text.
        Property description:
        The textual content of this TextInputControl.
      • getLength

        public final int getLength()
        Gets the value of the property length.
        Property description:
        The number of characters in the text input.
      • isEditable

        public final boolean isEditable()
        Gets the value of the property editable.
        Property description:
        Indicates whether this TextInputControl can be edited by the user.
      • setEditable

        public final void setEditable(boolean value)
        Sets the value of the property editable.
        Property description:
        Indicates whether this TextInputControl can be edited by the user.
      • getSelection

        public final IndexRange getSelection()
        Gets the value of the property selection.
        Property description:
        The current selection.
      • getSelectedText

        public final java.lang.String getSelectedText()
        Gets the value of the property selectedText.
        Property description:
        Defines the characters in the TextInputControl which are selected
      • getAnchor

        public final int getAnchor()
        Gets the value of the property anchor.
        Property description:
        The anchor of the text selection. The anchor and caretPosition make up the selection range. Selection must always be specified in terms of begin <= end, but anchor may be less than, equal to, or greater than the caretPosition. Depending on how the user selects text, the anchor might represent the lower or upper bound of the selection.
      • anchorProperty

        public final ReadOnlyIntegerProperty anchorProperty()
        The anchor of the text selection. The anchor and caretPosition make up the selection range. Selection must always be specified in terms of begin <= end, but anchor may be less than, equal to, or greater than the caretPosition. Depending on how the user selects text, the anchor might represent the lower or upper bound of the selection.
        See Also:
        getAnchor()
      • getCaretPosition

        public final int getCaretPosition()
        Gets the value of the property caretPosition.
        Property description:
        The current position of the caret within the text. The anchor and caretPosition make up the selection range. Selection must always be specified in terms of begin <= end, but anchor may be less than, equal to, or greater than the caretPosition. Depending on how the user selects text, the caretPosition might represent the lower or upper bound of the selection.
      • caretPositionProperty

        public final ReadOnlyIntegerProperty caretPositionProperty()
        The current position of the caret within the text. The anchor and caretPosition make up the selection range. Selection must always be specified in terms of begin <= end, but anchor may be less than, equal to, or greater than the caretPosition. Depending on how the user selects text, the caretPosition might represent the lower or upper bound of the selection.
        See Also:
        getCaretPosition()
      • getText

        public java.lang.String getText(int start,
         int end)
        Returns a subset of the text input's content.
        Parameters:
        start - must be a value between 0 and end - 1.
        end - must be less than or equal to the length
      • appendText

        public void appendText(java.lang.String text)
        Appends a sequence of characters to the content.
        Parameters:
        text - a non null String
      • insertText

        public void insertText(int index,
         java.lang.String text)
        Inserts a sequence of characters into the content.
        Parameters:
        index - The location to insert the text.
        text - The text to insert.
      • deleteText

        public void deleteText(IndexRange range)
        Removes a range of characters from the content.
        Parameters:
        range -
        See Also:
        deleteText(int, int)
      • deleteText

        public void deleteText(int start,
         int end)
        Removes a range of characters from the content.
        Parameters:
        start -
        end -
      • replaceText

        public void replaceText(IndexRange range,
         java.lang.String text)
        Replaces a range of characters with the given text.
        Parameters:
        range -
        text -
        See Also:
        replaceText(int, int, String)
      • replaceText

        public void replaceText(int start,
         int end,
         java.lang.String text)
        Replaces a range of characters with the given text.
        Parameters:
        start -
        end -
        text -
      • cut

        public void cut()
        Transfers the currently selected range in the text to the clipboard, removing the current selection.
      • copy

        public void copy()
        Transfers the currently selected range in the text to the clipboard, leaving the current selection.
      • paste

        public void paste()
        Transfers the contents in the clipboard into this text, replacing the current selection. If there is no selection, the contents in the clipboard is inserted at the current caret position.
      • selectBackward

        public void selectBackward()
        Moves the selection backward one char in the text. This may have the effect of deselecting, depending on the location of the anchor relative to the caretPosition. This function effectively just moves the caretPosition.
      • selectForward

        public void selectForward()
        Moves the selection forward one char in the text. This may have the effect of deselecting, depending on the location of the anchor relative to the caretPosition. This function effectively just moves the caret forward.
      • previousWord

        public void previousWord()
        Moves the caret to the beginning of previous word. This function also has the effect of clearing the selection.
      • nextWord

        public void nextWord()
        Moves the caret to the beginning of next word. This function also has the effect of clearing the selection.
      • endOfNextWord

        public void endOfNextWord()
        Moves the caret to the end of the next word. This function also has the effect of clearing the selection.
      • selectPreviousWord

        public void selectPreviousWord()
        Moves the caret to the beginning of previous word. This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to the beginning of previous word.
      • selectNextWord

        public void selectNextWord()
        Moves the caret to the beginning of next word. This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to the beginning of next word.
      • selectEndOfNextWord

        public void selectEndOfNextWord()
        Moves the caret to the end of the next word. This does not cause the selection to be cleared.
      • selectAll

        public void selectAll()
        Selects all text in the text input.
      • home

        public void home()
        Moves the caret to before the first char of the text. This function also has the effect of clearing the selection.
      • end

        public void end()
        Moves the caret to after the last char of the text. This function also has the effect of clearing the selection.
      • selectHome

        public void selectHome()
        Moves the caret to before the first char of text. This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to before the first char.
      • selectEnd

        public void selectEnd()
        Moves the caret to after the last char of text. This does not cause the selection to be cleared. Rather, the anchor stays put and the caretPosition is moved to after the last char.
      • deletePreviousChar

        public boolean deletePreviousChar()
        Deletes the character that precedes the current caret position from the text if there is no selection, or deletes the selection if there is one. This function returns true if the deletion succeeded, false otherwise.
      • deleteNextChar

        public boolean deleteNextChar()
        Deletes the character that follows the current caret position from the text if there is no selection, or deletes the selection if there is one. This function returns true if the deletion succeeded, false otherwise.
      • forward

        public void forward()
        Moves the caret position forward. If there is no selection, then the caret position is moved one character forward. If there is a selection, then the caret position is moved to the end of the selection and the selection cleared.
      • backward

        public void backward()
        Moves the caret position backward. If there is no selection, then the caret position is moved one character backward. If there is a selection, then the caret position is moved to the beginning of the selection and the selection cleared.
        Since:
        JavaFX 1.3
        This function is intended to be used by experts, primarily by those implementing new Skins or Behaviors. It is not common for developers or designers to access this function directly.
      • positionCaret

        public void positionCaret(int pos)
        Positions the caret to the position indicated by pos. This function will also clear the selection.
      • selectPositionCaret

        public void selectPositionCaret(int pos)
        Positions the caret to the position indicated by pos and extends the selection, if there is one. If there is no selection, then a selection is formed where the anchor is at the current caret position and the caretPosition is moved to pos.
      • selectRange

        public void selectRange(int anchor,
         int caretPosition)
        Positions the anchor and caretPosition explicitly.
      • extendSelection

        public void extendSelection(int pos)
        This function will extend the selection to include the specified pos. This is different from selectPositionCaret in that it does not simply move the caret. Rather, it will reposition the caret and anchor as necessary to ensure that pos becomes the new caret and the far other end of the selection becomes the anchor.
      • clear

        public void clear()
        Clears the text.
      • deselect

        public void deselect()
        Clears the selection.
      • replaceSelection

        public void replaceSelection(java.lang.String replacement)
        Replaces the selection with the given replacement String. If there is no selection, then the replacement text is simply inserted at the current caret position. If there was a selection, then the selection is cleared and the given replacement text inserted.
JavaFX 2.2

Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /