Java Code Examples for java.awt.peer.TextComponentPeer#setCaretPosition()
The following examples show how to use
java.awt.peer.TextComponentPeer#setCaretPosition() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextComponent.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 2
Source File: TextComponent.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 3
Source File: TextComponent.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 4
Source File: TextComponent.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 5
Source File: TextComponent.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 6
Source File: TextComponent.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 7
Source File: TextComponent.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 8
Source File: TextComponent.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 9
Source File: TextComponent.java From Java8CN with Apache License 2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 10
Source File: TextComponent.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 11
Source File: TextComponent.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the {@code TextComponent} contains no text) * and no error is returned. If the passed-in value is * less than 0, an {@code IllegalArgumentException} * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if {@code position} * is less than zero * @since 1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 12
Source File: TextComponent.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the {@code TextComponent} contains no text) * and no error is returned. If the passed-in value is * less than 0, an {@code IllegalArgumentException} * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if {@code position} * is less than zero * @since 1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 13
Source File: TextComponent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 14
Source File: TextComponent.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 15
Source File: TextComponent.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 16
Source File: TextComponent.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 17
Source File: TextComponent.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }
Example 18
Source File: TextComponent.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Sets the position of the text insertion caret. * The caret position is constrained to be between 0 * and the last character of the text, inclusive. * If the passed-in value is greater than this range, * the value is set to the last character (or 0 if * the <code>TextComponent</code> contains no text) * and no error is returned. If the passed-in value is * less than 0, an <code>IllegalArgumentException</code> * is thrown. * * @param position the position of the text insertion caret * @exception IllegalArgumentException if <code>position</code> * is less than zero * @since JDK1.1 */ public synchronized void setCaretPosition(int position) { if (position < 0) { throw new IllegalArgumentException("position less than zero."); } int maxposition = getText().length(); if (position > maxposition) { position = maxposition; } TextComponentPeer peer = (TextComponentPeer)this.peer; if (peer != null) { peer.setCaretPosition(position); } else { select(position, position); } }