|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.geom.RectangularShape java.awt.geom.Rectangle2D java.awt.Rectangle javax.swing.text.DefaultCaret oracle.javatools.editor.BasicCaret
A BasicCaret
extends the DefaultCaret to modify the
default behavior about the visibility of the selection, and other
extra features.
Nested Class Summary |
Nested classes inherited from class java.awt.geom.Rectangle2D |
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float |
Field Summary | |
static java.lang.String |
CARET_BLINK_RATE
The property name for the blink rate of the caret. |
static java.lang.String |
CARET_COLOR
The property name for the color of the caret. |
static int |
CARET_DOUBLE_UNDER_BAR
The constant for the double-thickness under bar caret shape. |
static int |
CARET_DOUBLE_VERTICAL_BAR
The constant for the double-thickness vertical bar caret shape. |
static java.lang.String |
CARET_ENABLE_BLINK
The property name for whether the caret should blink. |
static int |
CARET_OUTLINE_BOX
The constant for the outline box caret shape. |
static int |
CARET_QUAD_UNDER_BAR
The constant for the quad-thickness under bar caret shape. |
static int |
CARET_QUAD_VERTICAL_BAR
The constant for the quad-thickness vertical bar caret shape. |
static java.lang.String |
CARET_SHAPE_INSERT
The property name for the caret shape in insert mode. |
static java.lang.String |
CARET_SHAPE_OVERWRITE
The property name for the caret shape in ovewrite mode. |
static int |
CARET_SOLID_BOX
The constant for the solid box caret shape. |
static int |
CARET_TRIPLE_UNDER_BAR
The constant for the triple-thickness under bar caret shape. |
static int |
CARET_TRIPLE_VERTICAL_BAR
The constant for the triple-thickness vertical bar caret shape. |
static int |
CARET_UNDER_BAR
The constant for the single-thickness under bar caret shape. |
static int |
CARET_VERTICAL_BAR
The constant for the single-thickness vertical bar caret shape. |
static java.lang.String |
CARET_XOR_PAINTING
The property name for whether the caret should use xor painting or regular painting. |
static java.lang.String |
HIGHLIGHT_SELECTION_NAME
The name of the selection highlight style. |
protected int |
lastClickCount
Stores the click count from the last mousePressed event. |
protected int |
lastClickOffset
Stores the offset from the first mousePressed event. |
Fields inherited from class javax.swing.text.DefaultCaret |
changeEvent, listenerList |
Fields inherited from class java.awt.Rectangle |
height, width, x, y |
Fields inherited from class java.awt.geom.Rectangle2D |
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP |
Fields inherited from interface oracle.javatools.buffer.TextBufferListener |
EOL_TYPE_ATTRIBUTE, MODIFIED_ATTRIBUTE, READ_ONLY_ATTRIBUTE, RELOAD_END_ATTRIBUTE, RELOAD_START_ATTRIBUTE |
Constructor Summary | |
BasicCaret()
Creates a new instance of the BasicCaret. |
Method Summary | |
protected void |
adjustVisibility(java.awt.Rectangle newRect)
Scrolls the associated view (if necessary) to make the caret visible. |
void |
attributeUpdate(int attribute)
Provides notification regarding a change to one of the buffer attributes. |
protected void |
damage(java.awt.Rectangle r)
This damages the area surrounding the caret to cause it to be repainted in the a new location. |
void |
deinstall(javax.swing.text.JTextComponent component)
Called when the UI is being removed from the interface of a JTextComponent. |
protected void |
fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. |
void |
focusGained(java.awt.event.FocusEvent event)
Called when the component containing the caret gains focus. |
ActionInvoker |
getActionInvoker()
Fetches the action invoker to use to execute some particular action. |
boolean |
getInsertMode()
Fetches whether the caret is currently in insert mode or overwrite mode. |
protected int |
getOffsetForMouseEvent(java.awt.event.MouseEvent event)
Utility routine to fetch the editor offset most closely associated with an X-Y point in the given mouse event. |
void |
insertUpdate(int offset,
int count,
char[] insertedData)
Provides notification about an insertion into the text buffer. |
void |
install(javax.swing.text.JTextComponent component)
Called when the UI is being installed into the interface of a JTextComponent. |
void |
mouseClicked(java.awt.event.MouseEvent event)
Called when the mouse is clicked. |
void |
mouseDragged(java.awt.event.MouseEvent event)
Invoked when the mouse button has been pressed and dragged. |
void |
mousePressed(java.awt.event.MouseEvent event)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent event)
Invoked when a mouse button has been released on a component. |
protected void |
moveCaret(java.awt.event.MouseEvent event)
Tries to move the position of the caret from the coordinates of a mouse event, using viewToModel(). |
void |
moveDot(int dot)
Moves the caret position to some other position. |
void |
paint(java.awt.Graphics g)
Paints the caret. |
protected void |
positionCaret(java.awt.event.MouseEvent event)
Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel(). |
void |
propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed. |
void |
removeUpdate(int offset,
int count,
char[] removedData)
Provides notification about a removal from the text buffer. |
void |
setDot(int dot)
Sets the caret position and mark to some position. |
void |
setInsertMode(boolean insertMode)
Changes the caret mode between insert and overwrite mode. |
void |
toggleInsertMode()
Toggles the current insert mode. |
Methods inherited from class javax.swing.text.DefaultCaret |
addChangeListener, equals, focusLost, getBlinkRate, getChangeListeners, getComponent, getDot, getListeners, getMagicCaretPosition, getMark, getSelectionPainter, isSelectionVisible, isVisible, mouseEntered, mouseExited, mouseMoved, removeChangeListener, repaint, setBlinkRate, setMagicCaretPosition, setSelectionVisible, setVisible, toString |
Methods inherited from class java.awt.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, translate, union |
Methods inherited from class java.awt.geom.Rectangle2D |
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union |
Methods inherited from class java.awt.geom.RectangularShape |
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.Shape |
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects |
Field Detail |
public static final int CARET_VERTICAL_BAR
public static final int CARET_DOUBLE_VERTICAL_BAR
public static final int CARET_TRIPLE_VERTICAL_BAR
public static final int CARET_QUAD_VERTICAL_BAR
public static final int CARET_UNDER_BAR
public static final int CARET_DOUBLE_UNDER_BAR
public static final int CARET_TRIPLE_UNDER_BAR
public static final int CARET_QUAD_UNDER_BAR
public static final int CARET_OUTLINE_BOX
public static final int CARET_SOLID_BOX
public static final java.lang.String CARET_SHAPE_INSERT
public static final java.lang.String CARET_SHAPE_OVERWRITE
public static final java.lang.String CARET_ENABLE_BLINK
public static final java.lang.String CARET_BLINK_RATE
public static final java.lang.String CARET_COLOR
public static final java.lang.String CARET_XOR_PAINTING
protected int lastClickCount
protected int lastClickOffset
public static final java.lang.String HIGHLIGHT_SELECTION_NAME
Constructor Detail |
public BasicCaret()
Method Detail |
public void install(javax.swing.text.JTextComponent component)
install
in interface javax.swing.text.Caret
component
- the componentpublic void deinstall(javax.swing.text.JTextComponent component)
deinstall
in interface javax.swing.text.Caret
component
- the componentprotected void adjustVisibility(java.awt.Rectangle newRect)
newRect
- the new position to make visiblepublic void setDot(int dot)
setDot
in interface javax.swing.text.Caret
dot
- the position >= 0public void moveDot(int dot)
moveDot
in interface javax.swing.text.Caret
dot
- the position >= 0protected void fireStateChanged()
public ActionInvoker getActionInvoker()
protected void moveCaret(java.awt.event.MouseEvent event)
We override the default behavior here to take into account whether we are in insert or overwrite mode. If in insert mode, if the user clicks in the right side of a letter, the cursor will go to the right of the letter.
event
- the mouse eventprotected void positionCaret(java.awt.event.MouseEvent event)
We override the default behavior here to take into account whether we are in insert or overwrite mode. If in insert mode, if the user clicks in the right side of a letter, the cursor will go to the right of the letter.
event
- the mouse eventprotected int getOffsetForMouseEvent(java.awt.event.MouseEvent event)
event
- the mouse event that occurred
public void focusGained(java.awt.event.FocusEvent event)
Overriding default behavior so that the caret is visible even if the buffer is read only.
focusGained
in interface java.awt.event.FocusListener
event
- the focus eventFocusListener.focusGained(java.awt.event.FocusEvent)
protected void damage(java.awt.Rectangle r)
r
- the current location of the caretpublic void paint(java.awt.Graphics g)
paint
in interface javax.swing.text.Caret
g
- the graphics contextpublic boolean getInsertMode()
public void setInsertMode(boolean insertMode)
insertMode
- true if setting in insert modepublic void toggleInsertMode()
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
event
- the mouse eventMouseListener.mouseClicked(java.awt.event.MouseEvent)
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
event
- the mouse drag eventpublic void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
event
- the mouse event that occurredpublic void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
event
- the mouse event that occurredpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void insertUpdate(int offset, int count, char[] insertedData)
insertUpdate
in interface TextBufferListener
offset
- the offset where the insert took placecount
- the number of characters inserted (insertedData.length)insertedData
- the contents of the insertionpublic void removeUpdate(int offset, int count, char[] removedData)
removeUpdate
in interface TextBufferListener
offset
- the offset where the removal took placecount
- the number of characters removed (removedData.length)removedData
- the contents of the removalpublic void attributeUpdate(int attribute)
attributeUpdate
in interface TextBufferListener
attribute
- the attribute that changed
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.