< prev index next >
src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java
Print this page
@@ -47,13 +47,13 @@
* The timer thread fires asynchronously, and causes the caret to simply
* repaint the most recent bounding box. The caret also tracks change
* as the document is modified. Typically this will happen on the
* event dispatch thread as a result of some mouse or keyboard event.
* The caret behavior on both synchronous and asynchronous documents updates
- * is controlled by <code>UpdatePolicy</code> property. The repaint of the
+ * is controlled by {@code UpdatePolicy} property. The repaint of the
* new caret location will occur on the event thread in any case, as calls to
- * <code>modelToView</code> are only safe on the event thread.
+ * {@code modelToView} are only safe on the event thread.
* <p>
* The caret acts as a mouse and focus listener on the text component
* it has been installed in, and defines the caret semantics based upon
* those events. The listener methods can be reimplemented to change the
* semantics.
@@ -66,11 +66,11 @@
* The Highlighter bound to the associated text component is used to
* render the selection by default.
* Selection appearance can be customized by supplying a
* painter to use for the highlights. By default a painter is used that
* will render a solid color as specified in the associated text component
- * in the <code>SelectionColor</code> property. This can easily be changed
+ * in the {@code SelectionColor} property. This can easily be changed
* by reimplementing the
* {@link #getSelectionPainter getSelectionPainter}
* method.
* <p>
* A customized caret appearance can be achieved by reimplementing
@@ -97,11 +97,11 @@
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Timothy Prinzing
* @see Caret
*/
@@ -156,42 +156,42 @@
* means here the position relative to the start of the document.
* For example if
* a character is typed within editable text component it is inserted
* at the caret position and the caret moves to the next absolute
* position within the document due to insertion and if
- * <code>BACKSPACE</code> is typed then caret decreases its absolute
+ * {@code BACKSPACE} is typed then caret decreases its absolute
* position due to removal of a character before it. Sometimes
* it may be useful to turn off the caret position updates so that
* the caret stays at the same absolute position within the
* document position regardless of any document updates.
* <p>
* The following update policies are allowed:
* <ul>
- * <li><code>NEVER_UPDATE</code>: the caret stays at the same
+ * <li>{@code NEVER_UPDATE}: the caret stays at the same
* absolute position in the document regardless of any document
* updates, except when document length becomes less than
* the current caret position due to removal. In that case caret
* position is adjusted to the end of the document.
* The caret doesn't try to keep itself visible by scrolling
* the associated view when using this policy. </li>
- * <li><code>ALWAYS_UPDATE</code>: the caret always tracks document
+ * <li>{@code ALWAYS_UPDATE}: the caret always tracks document
* changes. For regular changes it increases its position
* if an insertion occurs before or at its current position,
* and decreases position if a removal occurs before
* its current position. For undo/redo updates it is always
* moved to the position where update occurred. The caret
* also tries to keep itself visible by calling
- * <code>adjustVisibility</code> method.</li>
- * <li><code>UPDATE_WHEN_ON_EDT</code>: acts like <code>ALWAYS_UPDATE</code>
+ * {@code adjustVisibility} method.</li>
+ * <li>{@code UPDATE_WHEN_ON_EDT}: acts like {@code ALWAYS_UPDATE}
* if the document updates are performed on the Event Dispatching Thread
- * and like <code>NEVER_UPDATE</code> if updates are performed on
+ * and like {@code NEVER_UPDATE} if updates are performed on
* other thread. </li>
* </ul> <p>
- * The default property value is <code>UPDATE_WHEN_ON_EDT</code>.
+ * The default property value is {@code UPDATE_WHEN_ON_EDT}.
*
- * @param policy one of the following values : <code>UPDATE_WHEN_ON_EDT</code>,
- * <code>NEVER_UPDATE</code>, <code>ALWAYS_UPDATE</code>
+ * @param policy one of the following values : {@code UPDATE_WHEN_ON_EDT},
+ * {@code NEVER_UPDATE}, {@code ALWAYS_UPDATE}
* @throws IllegalArgumentException if invalid value is passed
*
* @see #getUpdatePolicy
* @see #adjustVisibility
* @see #UPDATE_WHEN_ON_EDT
@@ -205,12 +205,12 @@
}
/**
* Gets the caret movement policy on document updates.
*
- * @return one of the following values : <code>UPDATE_WHEN_ON_EDT</code>,
- * <code>NEVER_UPDATE</code>, <code>ALWAYS_UPDATE</code>
+ * @return one of the following values : {@code UPDATE_WHEN_ON_EDT},
+ * {@code NEVER_UPDATE}, {@code ALWAYS_UPDATE}
*
* @see #setUpdatePolicy
* @see #UPDATE_WHEN_ON_EDT
* @see #NEVER_UPDATE
* @see #ALWAYS_UPDATE
@@ -767,11 +767,11 @@
/**
* Returns an array of all the change listeners
* registered on this caret.
*
- * @return all of this caret's <code>ChangeListener</code>s
+ * @return all of this caret's {@code ChangeListener}s
* or an empty
* array if no change listeners are currently registered
*
* @see #addChangeListener
* @see #removeChangeListener
@@ -812,16 +812,16 @@
* <code><em>Foo</em>Listener</code>s are registered using the
* <code>add<em>Foo</em>Listener</code> method.
*
* <p>
*
- * You can specify the <code>listenerType</code> argument
+ * You can specify the {@code listenerType} argument
* with a class literal,
* such as
* <code><em>Foo</em>Listener.class</code>.
* For example, you can query a
- * <code>DefaultCaret</code> <code>c</code>
+ * {@code DefaultCaret c}
* for its change listeners with the following code:
*
* <pre>ChangeListener[] cls = (ChangeListener[])(c.getListeners(ChangeListener.class));</pre>
*
* If no such listeners exist, this method returns an empty array.
@@ -829,13 +829,13 @@
* @param listenerType the type of listeners requested
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s on this component,
* or an empty array if no such
* listeners have been added
- * @exception ClassCastException if <code>listenerType</code>
+ * @exception ClassCastException if {@code listenerType}
* doesn't specify a class or interface that implements
- * <code>java.util.EventListener</code>
+ * {@code java.util.EventListener}
*
* @see #getChangeListeners
*
* @since 1.3
*/
@@ -887,17 +887,17 @@
}
/**
* Determines if the caret is currently active.
* <p>
- * This method returns whether or not the <code>Caret</code>
+ * This method returns whether or not the {@code Caret}
* is currently in a blinking state. It does not provide
* information as to whether it is currently blinked on or off.
* To determine if the caret is currently painted use the
- * <code>isVisible</code> method.
+ * {@code isVisible} method.
*
- * @return <code>true</code> if active else <code>false</code>
+ * @return {@code true} if active else {@code false}
* @see #isVisible
*
* @since 1.5
*/
public boolean isActive() {
@@ -906,13 +906,13 @@
/**
* Indicates whether or not the caret is currently visible. As the
* caret flashes on and off the return value of this will change
* between true, when the caret is painted, and false, when the
- * caret is not painted. <code>isActive</code> indicates whether
+ * caret is not painted. {@code isActive} indicates whether
* or not the caret is in a blinking state, such that it <b>can</b>
- * be visible, and <code>isVisible</code> indicates whether or not
+ * be visible, and {@code isVisible} indicates whether or not
* the caret <b>is</b> actually visible.
* <p>
* Subclasses that wish to render a different flashing caret
* should override paint and only paint the caret if this method
* returns true.
@@ -926,32 +926,32 @@
}
/**
* Sets the caret visibility, and repaints the caret.
* It is important to understand the relationship between this method,
- * <code>isVisible</code> and <code>isActive</code>.
- * Calling this method with a value of <code>true</code> activates the
- * caret blinking. Setting it to <code>false</code> turns it completely off.
+ * {@code isVisible} and {@code isActive}.
+ * Calling this method with a value of {@code true} activates the
+ * caret blinking. Setting it to {@code false} turns it completely off.
* To determine whether the blinking is active, you should call
- * <code>isActive</code>. In effect, <code>isActive</code> is an
+ * {@code isActive}. In effect, {@code isActive} is an
* appropriate corresponding "getter" method for this one.
- * <code>isVisible</code> can be used to fetch the current
+ * {@code isVisible} can be used to fetch the current
* visibility status of the caret, meaning whether or not it is currently
* painted. This status will change as the caret blinks on and off.
* <p>
* Here's a list showing the potential return values of both
- * <code>isActive</code> and <code>isVisible</code>
+ * {@code isActive} and {@code isVisible}
* after calling this method:
* <p>
- * <b><code>setVisible(true)</code></b>:
+ * <b>{@code setVisible(true)}</b>:
* <ul>
* <li>isActive(): true</li>
* <li>isVisible(): true or false depending on whether
* or not the caret is blinked on or off</li>
* </ul>
* <p>
- * <b><code>setVisible(false)</code></b>:
+ * <b>{@code setVisible(false)}</b>:
* <ul>
* <li>isActive(): false</li>
* <li>isVisible(): false</li>
* </ul>
*
@@ -1069,12 +1069,12 @@
/**
* Moves the caret position to the specified position, with the
* specified bias.
*
* @param dot the position >= 0
- * @param dotBias the bias for this position, not <code>null</code>
- * @throws IllegalArgumentException if the bias is <code>null</code>
+ * @param dotBias the bias for this position, not {@code null}
+ * @throws IllegalArgumentException if the bias is {@code null}
* @see Caret#moveDot
* @since 1.6
*/
public void moveDot(int dot, Position.Bias dotBias) {
if (dotBias == null) {
@@ -1136,12 +1136,12 @@
* Sets the caret position and mark to the specified position, with the
* specified bias. This implicitly sets the selection range
* to zero.
*
* @param dot the position >= 0
- * @param dotBias the bias for this position, not <code>null</code>
- * @throws IllegalArgumentException if the bias is <code>null</code>
+ * @param dotBias the bias for this position, not {@code null}
+ * @throws IllegalArgumentException if the bias is {@code null}
* @see Caret#setDot
* @since 1.6
*/
public void setDot(int dot, Position.Bias dotBias) {
if (dotBias == null) {
@@ -1296,11 +1296,11 @@
}
/**
* Repaints the new caret position, with the
* assumption that this is happening on the
- * event thread so that calling <code>modelToView</code>
+ * event thread so that calling {@code modelToView}
* is safe.
*/
void repaintNewCaret() {
if (component != null) {
TextUI mapper = component.getUI();
@@ -1383,11 +1383,11 @@
return handler;
}
/**
* This is invoked after the document changes to verify the current
- * dot/mark is valid. We do this in case the <code>NavigationFilter</code>
+ * dot/mark is valid. We do this in case the {@code NavigationFilter}
* changed where to position the dot, that resulted in the current location
* being bogus.
*/
private void ensureValidPosition() {
int length = component.getDocument().getLength();
@@ -1427,12 +1427,12 @@
* The superclass behavior of comparing rectangles
* is not desired, so this is changed to the Object
* behavior.
*
* @param obj the object to compare this font with
- * @return <code>true</code> if the objects are equal;
- * <code>false</code> otherwise
+ * @return {@code true} if the objects are equal;
+ * {@code false} otherwise
*/
public boolean equals(Object obj) {
return (this == obj);
}
< prev index next >