< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/TextInputControl.java

Print this page

        

*** 85,119 **** */ protected interface Content extends ObservableStringValue { /** * Retrieves a subset of the content. * ! * @param start ! * @param end */ public String get(int start, int end); /** * Inserts a sequence of characters into the content. * ! * @param index ! * @param text * @since JavaFX 2.1 */ public void insert(int index, String text, boolean notifyListeners); /** * Removes a sequence of characters from the content. * ! * @param start ! * @param end * @since JavaFX 2.1 */ public void delete(int start, int end, boolean notifyListeners); /** * Returns the number of characters represented by the content. */ public int length(); } /*************************************************************************** --- 85,123 ---- */ protected interface Content extends ObservableStringValue { /** * Retrieves a subset of the content. * ! * @param start the start ! * @param end the end ! * @return a subset of the content */ public String get(int start, int end); /** * Inserts a sequence of characters into the content. * ! * @param index the index ! * @param text the text string ! * @param notifyListeners the notify listener flag * @since JavaFX 2.1 */ public void insert(int index, String text, boolean notifyListeners); /** * Removes a sequence of characters from the content. * ! * @param start the start ! * @param end the end ! * @param notifyListeners the notify listener flag * @since JavaFX 2.1 */ public void delete(int start, int end, boolean notifyListeners); /** * Returns the number of characters represented by the content. + * @return the number of characters */ public int length(); } /***************************************************************************
*** 189,198 **** --- 193,203 ---- /** * The default font to use for text in the TextInputControl. If the TextInputControl's text is * rich text then this font may or may not be used depending on the font * information embedded in the rich text, but in any case where a default * font is required, this font will be used. + * @return the font property * @since JavaFX 8.0 */ public final ObjectProperty<Font> fontProperty() { if (font == null) { font = new StyleableObjectProperty<Font>(Font.getDefault()) {
*** 337,346 **** --- 342,352 ---- public final void setTextFormatter(TextFormatter<?> value) { textFormatter.set(value); } private final Content content; /** * Returns the text input's content model. + * @return the text input's content model */ protected final Content getContent() { return content; }
*** 441,450 **** --- 447,457 ---- /** * Returns a subset of the text input's content. * * @param start must be a value between 0 and end - 1. * @param end must be less than or equal to the length + * @return the subset of the text input's content */ public String getText(int start, int end) { if (start > end) { throw new IllegalArgumentException("The start must be <= the end"); }
*** 878,887 **** --- 885,895 ---- /** * 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. + * @return true if the deletion succeeded, false otherwise */ public boolean deletePreviousChar() { boolean failed = true; if (isEditable() && !isDisabled()) { final String text = getText();
*** 908,917 **** --- 916,926 ---- /** * 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. + * @return true if the deletion succeeded, false otherwise */ public boolean deleteNextChar() { boolean failed = true; if (isEditable() && !isDisabled()) { final int textLength = getLength();
*** 968,978 **** * 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. * ! * @expert 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. */ public void backward() { // user has moved caret to the left --- 977,987 ---- * 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. * ! * Note: 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. */ public void backward() { // user has moved caret to the left
*** 994,1003 **** --- 1003,1013 ---- } /** * Positions the caret to the position indicated by {@code pos}. This * function will also clear the selection. + * @param pos the position */ public void positionCaret(int pos) { final int p = Utils.clamp(0, pos, getLength()); selectRange(p, p); }
*** 1005,1021 **** --- 1015,1034 ---- /** * Positions the caret to the position indicated by {@code 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. + * @param pos the position */ public void selectPositionCaret(int pos) { selectRange(getAnchor(), Utils.clamp(0, pos, getLength())); } /** * Positions the anchor and caretPosition explicitly. + * @param anchor the anchor + * @param caretPosition the caretPosition */ public void selectRange(int anchor, int caretPosition) { caretPosition = Utils.clamp(0, caretPosition, getLength()); anchor = Utils.clamp(0, anchor, getLength());
*** 1042,1051 **** --- 1055,1065 ---- * 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. + * @param pos the position */ public void extendSelection(int pos) { final int p = Utils.clamp(0, pos, getLength()); final int dot = getCaretPosition(); final int mark = getAnchor();
*** 1080,1089 **** --- 1094,1104 ---- /** * 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. + * @param replacement the replacement string */ public void replaceSelection(String replacement) { replaceText(getSelection(), replacement); }
< prev index next >