<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_77) on Fri Apr 22 13:46:43 UTC 2016 --> <title>TextFormatter.Change (JavaFX 8)</title> <meta name="date" content="2016-04-22"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="TextFormatter.Change (JavaFX 8)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/TextFormatter.Change.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">JavaFX 8</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../javafx/scene/control/TextFormatter.html" title="class in javafx.scene.control"><span class="typeNameLink">Prev Class</span></a></li> <li><a href="../../../javafx/scene/control/TextInputControl.html" title="class in javafx.scene.control"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?javafx/scene/control/TextFormatter.Change.html" target="_top">Frames</a></li> <li><a href="TextFormatter.Change.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">javafx.scene.control</div> <h2 title="Class TextFormatter.Change" class="title">Class TextFormatter.Change</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li>javafx.scene.control.TextFormatter.Change</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html?is-external=true" title="class or interface in java.lang">Cloneable</a></dd> </dl> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../javafx/scene/control/TextFormatter.html" title="class in javafx.scene.control">TextFormatter</a><<a href="../../../javafx/scene/control/TextFormatter.html" title="type parameter in TextFormatter">V</a>></dd> </dl> <hr> <br> <pre>public static final class <span class="typeNameLabel">TextFormatter.Change</span> extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> implements <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html?is-external=true" title="class or interface in java.lang">Cloneable</a></pre> <div class="block">Contains the state representing a change in the content or selection for a TextInputControl. This object is passed to any registered <code>formatter</code> on the TextInputControl whenever the text for the TextInputControl is modified. <p> This class contains state and convenience methods for determining what change occurred on the control. It also has a reference to the TextInputControl itself so that the developer may query any other state on the control. Note that you should never modify the state of the control directly from within the formatter handler. </p> <p> The Change of the text is described by <b>range</b> (<a href="../../../javafx/scene/control/TextFormatter.Change.html#getRangeStart--"><code>getRangeStart()</code></a>, <a href="../../../javafx/scene/control/TextFormatter.Change.html#getRangeEnd--"><code>getRangeEnd()</code></a>) and text (<a href="../../../javafx/scene/control/TextFormatter.Change.html#getText--"><code>getText()</code></a>. There are 3 cases that can occur: <ul> <li><b>Some text was deleted:</b> In this case, <code>text</code> is empty and <code>range</code> denotes the <code>range</code> of deleted text. E.g. In text "Lorem ipsum dolor sit amet", removal of the second word would result in <code>range</code> being (6,11) and an empty <code>text</code>. Similarly, if you want to delete some different or additional text, just set the <code>range</code>. If you want to remove first word instead of the second, just call <code>setRange(0,5)</code></li> <li><b>Some text was added:</b> Now the <code>range</code> is empty (means nothing was deleted), but it's value is still important. Both the start and end of the <code>range</code> point to the index wheret the new text was added. E.g. adding "ipsum " to "Lorem dolor sit amet" would result in a change with <code>range</code> of (6,6) and <code>text</code> containing the String "ipsum ".</li> <li><b>Some text was replaced:</b> The combination of the 2 cases above. Both <code>text</code> and <code>range</code> are not empty. The text in <code>range</code> is deleted and replaced by <code>text</code> in the Change. The new text is added instead of the old text, which is at the beginning of the <code>range</code>. E.g. when some text is being deleted, you can simply replace it by some placeholder text just by setting a new text (<code>setText("new text")</code>)</li> </ul> </p> <p> The Change is mutable, but not observable. It should be used only for the life of a single change. It is intended that the Change will be modified from within the formatter. </p></div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>JavaFX 8u40</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../../javafx/scene/control/TextFormatter.Change.html" title="class in javafx.scene.control">TextFormatter.Change</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#clone--">clone</a></span>()</code> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getAnchor--">getAnchor</a></span>()</code> <div class="block">Gets the new anchor.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getCaretPosition--">getCaretPosition</a></span>()</code> <div class="block">Gets the new caret position.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code><a href="../../../javafx/scene/control/Control.html" title="class in javafx.scene.control">Control</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getControl--">getControl</a></span>()</code> <div class="block">Gets the control associated with this change.</div> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlAnchor--">getControlAnchor</a></span>()</code> <div class="block">Gets the current anchor position of the control.</div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlCaretPosition--">getControlCaretPosition</a></span>()</code> <div class="block">Gets the current caret position of the control.</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--">getControlNewText</a></span>()</code> <div class="block">Gets the complete new text which will be used on the control after this change.</div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlText--">getControlText</a></span>()</code> <div class="block">This is the full text that control has before the change.</div> </td> </tr> <tr id="i8" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getRangeEnd--">getRangeEnd</a></span>()</code> <div class="block">Gets the end index into the <a href="../../../javafx/scene/control/TextInputControl.html#getText--"><code>TextInputControl.getText()</code></a> for the modification.</div> </td> </tr> <tr id="i9" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getRangeStart--">getRangeStart</a></span>()</code> <div class="block">Gets the start index into the <a href="../../../javafx/scene/control/TextInputControl.html#getText--"><code>TextInputControl.getText()</code></a> for the modification.</div> </td> </tr> <tr id="i10" class="altColor"> <td class="colFirst"><code><a href="../../../javafx/scene/control/IndexRange.html" title="class in javafx.scene.control">IndexRange</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getSelection--">getSelection</a></span>()</code> <div class="block">Gets the selection of this change.</div> </td> </tr> <tr id="i11" class="rowColor"> <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#getText--">getText</a></span>()</code> <div class="block">Gets the text used in this change.</div> </td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#isAdded--">isAdded</a></span>()</code> <div class="block">Gets whether this change was in response to text being added.</div> </td> </tr> <tr id="i13" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#isContentChange--">isContentChange</a></span>()</code> <div class="block">The content change is any of add, delete or replace changes.</div> </td> </tr> <tr id="i14" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#isDeleted--">isDeleted</a></span>()</code> <div class="block">Gets whether this change was in response to text being deleted.</div> </td> </tr> <tr id="i15" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#isReplaced--">isReplaced</a></span>()</code> <div class="block">Gets whether this change was in response to text being replaced.</div> </td> </tr> <tr id="i16" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#selectRange-int-int-">selectRange</a></span>(int newAnchor, int newCaretPosition)</code> <div class="block">Sets the selection.</div> </td> </tr> <tr id="i17" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#setAnchor-int-">setAnchor</a></span>(int newAnchor)</code> <div class="block">Sets the anchor.</div> </td> </tr> <tr id="i18" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#setCaretPosition-int-">setCaretPosition</a></span>(int newCaretPosition)</code> <div class="block">Sets the caret position.</div> </td> </tr> <tr id="i19" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#setRange-int-int-">setRange</a></span>(int start, int end)</code> <div class="block">A method assigning both the start and end values together, in such a way as to ensure they are valid with respect to each other.</div> </td> </tr> <tr id="i20" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#setText-java.lang.String-">setText</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> value)</code> <div class="block">Sets the text to use in this change.</div> </td> </tr> <tr id="i21" class="rowColor"> <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/control/TextFormatter.Change.html#toString--">toString</a></span>()</code> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getControl--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getControl</h4> <pre>public final <a href="../../../javafx/scene/control/Control.html" title="class in javafx.scene.control">Control</a> getControl()</pre> <div class="block">Gets the control associated with this change.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The control associated with this change. This will never be null.</dd> </dl> </li> </ul> <a name="getRangeStart--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getRangeStart</h4> <pre>public final int getRangeStart()</pre> <div class="block">Gets the start index into the <a href="../../../javafx/scene/control/TextInputControl.html#getText--"><code>TextInputControl.getText()</code></a> for the modification. This will always be a value > 0 and <= <a href="../../../javafx/scene/control/TextInputControl.html#getLength--"><code>TextInputControl.getLength()</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The start index</dd> </dl> </li> </ul> <a name="getRangeEnd--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getRangeEnd</h4> <pre>public final int getRangeEnd()</pre> <div class="block">Gets the end index into the <a href="../../../javafx/scene/control/TextInputControl.html#getText--"><code>TextInputControl.getText()</code></a> for the modification. This will always be a value > <a href="../../../javafx/scene/control/TextFormatter.Change.html#getRangeStart--"><code>getRangeStart()</code></a> and <= <a href="../../../javafx/scene/control/TextInputControl.html#getLength--"><code>TextInputControl.getLength()</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The end index</dd> </dl> </li> </ul> <a name="setRange-int-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setRange</h4> <pre>public final void setRange(int start, int end)</pre> <div class="block">A method assigning both the start and end values together, in such a way as to ensure they are valid with respect to each other. The start must be less than or equal to the end.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>start</code> - The new start value. Must be a valid start value</dd> <dd><code>end</code> - The new end value. Must be a valid end value</dd> </dl> </li> </ul> <a name="getCaretPosition--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getCaretPosition</h4> <pre>public final int getCaretPosition()</pre> <div class="block">Gets the new caret position. This value will always be > 0 and <= <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>.getLength()}</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The new caret position</dd> </dl> </li> </ul> <a name="getAnchor--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getAnchor</h4> <pre>public final int getAnchor()</pre> <div class="block">Gets the new anchor. This value will always be > 0 and <= <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>.getLength()}</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The new anchor position</dd> </dl> </li> </ul> <a name="getControlCaretPosition--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getControlCaretPosition</h4> <pre>public final int getControlCaretPosition()</pre> <div class="block">Gets the current caret position of the control.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The previous caret position</dd> </dl> </li> </ul> <a name="getControlAnchor--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getControlAnchor</h4> <pre>public final int getControlAnchor()</pre> <div class="block">Gets the current anchor position of the control.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The previous anchor</dd> </dl> </li> </ul> <a name="selectRange-int-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>selectRange</h4> <pre>public final void selectRange(int newAnchor, int newCaretPosition)</pre> <div class="block">Sets the selection. The anchor and caret position values must be > 0 and <= <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>.getLength()}. Note that there is an order dependence here, in that the positions should be specified after the new text has been specified.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>newAnchor</code> - The new anchor position</dd> <dd><code>newCaretPosition</code> - The new caret position</dd> </dl> </li> </ul> <a name="getSelection--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSelection</h4> <pre>public final <a href="../../../javafx/scene/control/IndexRange.html" title="class in javafx.scene.control">IndexRange</a> getSelection()</pre> <div class="block">Gets the selection of this change. Note that the selection range refers to <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>, not the current control text.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The selected range of this change.</dd> </dl> </li> </ul> <a name="setAnchor-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setAnchor</h4> <pre>public final void setAnchor(int newAnchor)</pre> <div class="block">Sets the anchor. The anchor value must be > 0 and <= <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>.getLength()}. Note that there is an order dependence here, in that the position should be specified after the new text has been specified.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>newAnchor</code> - The new anchor position</dd> </dl> </li> </ul> <a name="setCaretPosition-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setCaretPosition</h4> <pre>public final void setCaretPosition(int newCaretPosition)</pre> <div class="block">Sets the caret position. The caret position value must be > 0 and <= <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>.getLength()}. Note that there is an order dependence here, in that the position should be specified after the new text has been specified.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>newCaretPosition</code> - The new caret position</dd> </dl> </li> </ul> <a name="getText--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getText</h4> <pre>public final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getText()</pre> <div class="block">Gets the text used in this change. For example, this may be new text being added, or text which is replacing all the control's text within the range of start and end. Typically it is an empty string only for cases where the range is being deleted.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The text involved in this change. This will never be null.</dd> </dl> </li> </ul> <a name="setText-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setText</h4> <pre>public final void setText(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> value)</pre> <div class="block">Sets the text to use in this change. This is used to replace the range from start to end, if such a range exists, or to insert text at the position represented by start == end.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>value</code> - The text. This cannot be null.</dd> </dl> </li> </ul> <a name="getControlText--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getControlText</h4> <pre>public final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getControlText()</pre> <div class="block">This is the full text that control has before the change. To get the text after this change, use <a href="../../../javafx/scene/control/TextFormatter.Change.html#getControlNewText--"><code>getControlNewText()</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the previous text of control</dd> </dl> </li> </ul> <a name="getControlNewText--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getControlNewText</h4> <pre>public final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getControlNewText()</pre> <div class="block">Gets the complete new text which will be used on the control after this change. Note that some controls (such as TextField) may do further filtering after the change is made (such as stripping out newlines) such that you cannot assume that the newText will be exactly the same as what is finally set as the content on the control, however it is correct to assume that this is the case for the purpose of computing the new caret position and new anchor position (as those values supplied will be modified as necessary after the control has stripped any additional characters that the control might strip).</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The controls proposed new text at the time of this call, according to the state set for start, end, and text properties on this Change object.</dd> </dl> </li> </ul> <a name="isAdded--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isAdded</h4> <pre>public final boolean isAdded()</pre> <div class="block">Gets whether this change was in response to text being added. Note that after the Change object is modified by the formatter (by one of the setters) the return value of this method is not altered. It answers as to whether this change was fired as a result of text being added, not whether text will end up being added in the end.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if text was being added</dd> </dl> </li> </ul> <a name="isDeleted--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isDeleted</h4> <pre>public final boolean isDeleted()</pre> <div class="block">Gets whether this change was in response to text being deleted. Note that after the Change object is modified by the formatter (by one of the setters) the return value of this method is not altered. It answers as to whether this change was fired as a result of text being deleted, not whether text will end up being deleted in the end.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if text was being deleted</dd> </dl> </li> </ul> <a name="isReplaced--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isReplaced</h4> <pre>public final boolean isReplaced()</pre> <div class="block">Gets whether this change was in response to text being replaced. Note that after the Change object is modified by the formatter (by one of the setters) the return value of this method is not altered. It answers as to whether this change was fired as a result of text being replaced, not whether text will end up being replaced in the end.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if text was being replaced</dd> </dl> </li> </ul> <a name="isContentChange--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isContentChange</h4> <pre>public final boolean isContentChange()</pre> <div class="block">The content change is any of add, delete or replace changes. Basically it's a shortcut for <code>c.isAdded() || c.isDeleted() </code>;</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>true if the content changed</dd> </dl> </li> </ul> <a name="toString--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>toString</h4> <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> toString()</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> </dl> </li> </ul> <a name="clone--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>clone</h4> <pre>public <a href="../../../javafx/scene/control/TextFormatter.Change.html" title="class in javafx.scene.control">TextFormatter.Change</a> clone()</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/TextFormatter.Change.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">JavaFX 8</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../javafx/scene/control/TextFormatter.html" title="class in javafx.scene.control"><span class="typeNameLink">Prev Class</span></a></li> <li><a href="../../../javafx/scene/control/TextInputControl.html" title="class in javafx.scene.control"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?javafx/scene/control/TextFormatter.Change.html" target="_top">Frames</a></li> <li><a href="TextFormatter.Change.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><small><a href="https://docs.oracle.com/javase/8/docs/legal/cpyr.html">Copyright</a> (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.</small></small></p> </body> </html>