81 * This enables the caret to repaint in a thread-safe manner when the
82 * caret moves without making a call to modelToView which is unstable
83 * between model updates and view repair (i.e. the order of delivery
84 * to DocumentListeners is not guaranteed).
85 * <p>
86 * The magic caret position is set to null when the caret position changes.
87 * A timer is used to determine the new location (after the caret change).
88 * When the timer fires, if the magic caret position is still null it is
89 * reset to the current caret position. Any actions that change
90 * the caret position and want the magic caret position to remain the
91 * same, must remember the magic caret position, change the cursor, and
92 * then set the magic caret position to its original value. This has the
93 * benefit that only actions that want the magic caret position to persist
94 * (such as open/down) need to know about it.
95 * <p>
96 * <strong>Warning:</strong>
97 * Serialized objects of this class will not be compatible with
98 * future Swing releases. The current serialization support is
99 * appropriate for short term storage or RMI between applications running
100 * the same version of Swing. As of 1.4, support for long term storage
101 * of all JavaBeans™
102 * has been added to the <code>java.beans</code> package.
103 * Please see {@link java.beans.XMLEncoder}.
104 *
105 * @author Timothy Prinzing
106 * @see Caret
107 */
108 @SuppressWarnings("serial") // Same-version serialization only
109 public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener {
110
111 /**
112 * Indicates that the caret position is to be updated only when
113 * document changes are performed on the Event Dispatching Thread.
114 * @see #setUpdatePolicy
115 * @see #getUpdatePolicy
116 * @since 1.5
117 */
118 public static final int UPDATE_WHEN_ON_EDT = 0;
119
120 /**
121 * Indicates that the caret should remain at the same
|
81 * This enables the caret to repaint in a thread-safe manner when the
82 * caret moves without making a call to modelToView which is unstable
83 * between model updates and view repair (i.e. the order of delivery
84 * to DocumentListeners is not guaranteed).
85 * <p>
86 * The magic caret position is set to null when the caret position changes.
87 * A timer is used to determine the new location (after the caret change).
88 * When the timer fires, if the magic caret position is still null it is
89 * reset to the current caret position. Any actions that change
90 * the caret position and want the magic caret position to remain the
91 * same, must remember the magic caret position, change the cursor, and
92 * then set the magic caret position to its original value. This has the
93 * benefit that only actions that want the magic caret position to persist
94 * (such as open/down) need to know about it.
95 * <p>
96 * <strong>Warning:</strong>
97 * Serialized objects of this class will not be compatible with
98 * future Swing releases. The current serialization support is
99 * appropriate for short term storage or RMI between applications running
100 * the same version of Swing. As of 1.4, support for long term storage
101 * of all JavaBeans
102 * has been added to the <code>java.beans</code> package.
103 * Please see {@link java.beans.XMLEncoder}.
104 *
105 * @author Timothy Prinzing
106 * @see Caret
107 */
108 @SuppressWarnings("serial") // Same-version serialization only
109 public class DefaultCaret extends Rectangle implements Caret, FocusListener, MouseListener, MouseMotionListener {
110
111 /**
112 * Indicates that the caret position is to be updated only when
113 * document changes are performed on the Event Dispatching Thread.
114 * @see #setUpdatePolicy
115 * @see #getUpdatePolicy
116 * @since 1.5
117 */
118 public static final int UPDATE_WHEN_ON_EDT = 0;
119
120 /**
121 * Indicates that the caret should remain at the same
|