Class BasicTextUI.BasicCaret
java.lang.Object
java.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
javax.swing.text.DefaultCaret
javax.swing.plaf.basic.BasicTextUI.BasicCaret
- All Implemented Interfaces:
FocusListener, MouseListener, MouseMotionListener, Shape, Serializable, Cloneable, EventListener, UIResource, Caret
- Enclosing class:
BasicTextUI
Default implementation of the interface
Caret.-
Nested Class Summary
Nested classes/interfaces declared in class Rectangle2D
Rectangle2D.Double, Rectangle2D.FloatModifier and TypeClassDescriptionstatic classTheDoubleclass defines a rectangle specified in double coordinates.static classTheFloatclass defines a rectangle specified in float coordinates. -
Field Summary
Fields declared in class DefaultCaret
ALWAYS_UPDATE, changeEvent, listenerList, NEVER_UPDATE, UPDATE_WHEN_ON_EDTModifier and TypeFieldDescriptionstatic final intIndicates that the caret position is to be always updated accordingly to the document changes regardless whether the document updates are performed on the Event Dispatching Thread or not.protected ChangeEventThe change event for the model.protected EventListenerListThe event listener list.static final intIndicates that the caret should remain at the same absolute position in the document regardless of any document updates, except when the document length becomes less than the current caret position due to removal.static final intIndicates that the caret position is to be updated only when document changes are performed on the Event Dispatching Thread.Fields declared in class Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOPModifier and TypeFieldDescriptionstatic final intThe bitmask that indicates that a point lies below thisRectangle2D.static final intThe bitmask that indicates that a point lies to the left of thisRectangle2D.static final intThe bitmask that indicates that a point lies to the right of thisRectangle2D.static final intThe bitmask that indicates that a point lies above thisRectangle2D. -
Constructor Summary
Constructors -
Method Summary
Methods declared in class DefaultCaret
addChangeListener, adjustVisibility, damage, deinstall, equals, fireStateChanged, focusGained, focusLost, getBlinkRate, getChangeListeners, getComponent, getDot, getDotBias, getListeners, getMagicCaretPosition, getMark, getMarkBias, getSelectionPainter, getUpdatePolicy, install, isActive, isSelectionVisible, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, moveCaret, moveDot, moveDot, paint, positionCaret, removeChangeListener, repaint, setBlinkRate, setDot, setDot, setMagicCaretPosition, setSelectionVisible, setUpdatePolicy, setVisibleModifier and TypeMethodDescriptionvoidAdds a listener to track whenever the caret position has been changed.protected voidadjustVisibility(Rectangle nloc) Scrolls the associated view (if necessary) to make the caret visible.protected voidDamages the area surrounding the caret to cause it to be repainted in a new location.voidCalled when the UI is being removed from the interface of a JTextComponent.booleanCompares this object to the specified object.protected voidNotifies all listeners that have registered interest for notification on this event type.voidCalled when the component containing the caret gains focus.voidCalled when the component containing the caret loses focus.intGets the caret blink rate.Returns an array of all the change listeners registered on this caret.protected final JTextComponentGets the text editor component that this caret is bound to.intgetDot()Fetches the current position of the caret.Returns the bias of the caret position.<T extends EventListener>
T[]getListeners(Class<T> listenerType) Returns an array of all the objects currently registered asFooListeners upon this caret.Gets the saved caret position.intgetMark()Fetches the current position of the mark.Returns the bias of the mark.protected Highlighter.HighlightPainterGets the painter for the Highlighter.intGets the caret movement policy on document updates.voidCalled when the UI is being installed into the interface of a JTextComponent.booleanisActive()Determines if the caret is currently active.booleanChecks whether the current selection is visible.booleanIndicates whether or not the caret is currently visible.voidCalled when the mouse is clicked.voidMoves the caret position according to the mouse pointer's current location.voidCalled when the mouse enters a region.voidCalled when the mouse exits a region.voidCalled when the mouse is moved.voidIf button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position.voidCalled when the mouse is released.protected voidTries to move the position of the caret from the coordinates of a mouse event, using viewToModel().voidmoveDot(int dot) Moves the caret position to the specified position, with a forward bias.voidmoveDot(int dot, Position.Bias dotBias) Moves the caret position to the specified position, with the specified bias.voidRenders the caret as a vertical line.protected voidTries to set the position of the caret from the coordinates of a mouse event, using viewToModel().voidRemoves a listener that was tracking caret position changes.protected final voidrepaint()Cause the caret to be painted.voidsetBlinkRate(int rate) Sets the caret blink rate.voidsetDot(int dot) Sets the caret position and mark to the specified position, with a forward bias.voidsetDot(int dot, Position.Bias dotBias) Sets the caret position and mark to the specified position, with the specified bias.voidSaves the current caret position.voidsetSelectionVisible(boolean vis) Changes the selection visibility.voidsetUpdatePolicy(int policy) Sets the caret movement policy on the document updates.voidsetVisible(boolean e) Sets the caret visibility, and repaints the caret.Methods declared in class Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, unionModifier and TypeMethodDescriptionvoidadd(int newx, int newy) Adds a point, specified by the integer argumentsnewx,newyto the bounds of thisRectangle.voidAdds the specifiedPointto the bounds of thisRectangle.voidAdds aRectangleto thisRectangle.booleancontains(int x, int y) Checks whether or not thisRectanglecontains the point at the specified location(x,y).booleancontains(int X, int Y, int W, int H) Checks whether thisRectangleentirely contains theRectangleat the specified location(X,Y)with the specified dimensions(W,H).booleanChecks whether or not thisRectanglecontains the specifiedPoint.booleanChecks whether or not thisRectangleentirely contains the specifiedRectangle.Returns a newRectangle2Dobject representing the intersection of thisRectangle2Dwith the specifiedRectangle2D.Returns a newRectangle2Dobject representing the union of thisRectangle2Dwith the specifiedRectangle2D.Gets the boundingRectangleof thisRectangle.Returns a high precision and more accurate bounding box of theShapethan thegetBoundsmethod.doubleReturns the height of the boundingRectangleindoubleprecision.Returns the location of thisRectangle.getSize()Gets the size of thisRectangle, represented by the returnedDimension.doublegetWidth()Returns the width of the boundingRectangleindoubleprecision.doublegetX()Returns the X coordinate of the boundingRectangleindoubleprecision.doublegetY()Returns the Y coordinate of the boundingRectangleindoubleprecision.voidgrow(int h, int v) Resizes theRectangleboth horizontally and vertically.booleaninside(int X, int Y) Deprecated.Computes the intersection of thisRectanglewith the specifiedRectangle.booleanDetermines whether or not thisRectangleand the specifiedRectangleintersect.booleanisEmpty()Determines whether theRectangularShapeis empty.voidmove(int x, int y) Deprecated.As of JDK version 1.1, replaced bysetLocation(int, int).intoutcode(double x, double y) Determines where the specified coordinates lie with respect to thisRectangle2D.voidreshape(int x, int y, int width, int height) Deprecated.As of JDK version 1.1, replaced bysetBounds(int, int, int, int).voidresize(int width, int height) Deprecated.As of JDK version 1.1, replaced bysetSize(int, int).voidsetBounds(int x, int y, int width, int height) Sets the boundingRectangleof thisRectangleto the specifiedx,y,width, andheight.voidSets the boundingRectangleof thisRectangleto match the specifiedRectangle.voidsetLocation(int x, int y) Moves thisRectangleto the specified location.voidsetLocation(Point p) Moves thisRectangleto the specified location.voidsetRect(double x, double y, double width, double height) Sets the bounds of thisRectangleto the integer bounds which encompass the specifiedx,y,width, andheight.voidsetSize(int width, int height) Sets the size of thisRectangleto the specified width and height.voidSets the size of thisRectangleto match the specifiedDimension.toString()Returns aStringrepresenting thisRectangleand its values.voidtranslate(int dx, int dy) Translates thisRectanglethe indicated distance, to the right along the X coordinate axis, and downward along the Y coordinate axis.Computes the union of thisRectanglewith the specifiedRectangle.Methods declared in class Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, unionModifier and TypeMethodDescriptionvoidadd(double newx, double newy) Adds a point, specified by the double precision argumentsnewxandnewy, to thisRectangle2D.voidAdds thePoint2Dobjectptto thisRectangle2D.voidadd(Rectangle2D r) Adds aRectangle2Dobject to thisRectangle2D.booleancontains(double x, double y) Tests if the specified coordinates are inside the boundary of theShape, as described by the definition of insideness.booleancontains(double x, double y, double w, double h) Tests if the interior of theShapeentirely contains the specified rectangular area.Returns an iteration object that defines the boundary of thisRectangle2D.getPathIterator(AffineTransform at, double flatness) Returns an iteration object that defines the boundary of the flattenedRectangle2D.inthashCode()Returns the hashcode for thisRectangle2D.static voidintersect(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) Intersects the pair of specified sourceRectangle2Dobjects and puts the result into the specified destinationRectangle2Dobject.booleanintersects(double x, double y, double w, double h) Tests if the interior of theShapeintersects the interior of a specified rectangular area.booleanintersectsLine(double x1, double y1, double x2, double y2) Tests if the specified line segment intersects the interior of thisRectangle2D.booleanTests if the specified line segment intersects the interior of thisRectangle2D.intDetermines where the specifiedPoint2Dlies with respect to thisRectangle2D.voidsetFrame(double x, double y, double w, double h) Sets the location and size of the outer bounds of thisRectangle2Dto the specified rectangular values.voidSets thisRectangle2Dto be the same as the specifiedRectangle2D.static voidunion(Rectangle2D src1, Rectangle2D src2, Rectangle2D dest) Unions the pair of sourceRectangle2Dobjects and puts the result into the specified destinationRectangle2Dobject.Methods declared in class RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonalModifier and TypeMethodDescriptionclone()Creates a new object of the same class and with the same contents as this object.booleanTests if a specifiedPoint2Dis inside the boundary of theShape, as described by the definition of insideness.booleanTests if the interior of theShapeentirely contains the specifiedRectangle2D.doubleReturns the X coordinate of the center of the framing rectangle of theShapeindoubleprecision.doubleReturns the Y coordinate of the center of the framing rectangle of theShapeindoubleprecision.getFrame()Returns the framingRectangle2Dthat defines the overall shape of this object.doublegetMaxX()Returns the largest X coordinate of the framing rectangle of theShapeindoubleprecision.doublegetMaxY()Returns the largest Y coordinate of the framing rectangle of theShapeindoubleprecision.doublegetMinX()Returns the smallest X coordinate of the framing rectangle of theShapeindoubleprecision.doublegetMinY()Returns the smallest Y coordinate of the framing rectangle of theShapeindoubleprecision.booleanTests if the interior of theShapeintersects the interior of a specifiedRectangle2D.voidsetFrame(Point2D loc, Dimension2D size) Sets the location and size of the framing rectangle of thisShapeto the specifiedPoint2DandDimension2D, respectively.voidSets the framing rectangle of thisShapeto be the specifiedRectangle2D.voidsetFrameFromCenter(double centerX, double centerY, double cornerX, double cornerY) Sets the framing rectangle of thisShapebased on the specified center point coordinates and corner point coordinates.voidsetFrameFromCenter(Point2D center, Point2D corner) Sets the framing rectangle of thisShapebased on a specified centerPoint2Dand cornerPoint2D.voidsetFrameFromDiagonal(double x1, double y1, double x2, double y2) Sets the diagonal of the framing rectangle of thisShapebased on the two specified coordinates.voidsetFrameFromDiagonal(Point2D p1, Point2D p2) Sets the diagonal of the framing rectangle of thisShapebased on two specifiedPoint2Dobjects.Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
BasicCaret
public BasicCaret()Constructs aBasicCaret.
-
contains(int, int).