public class ConfigurableCaret
extends javax.swing.text.DefaultCaret
RTextArea. This caret has all of the properties
that javax.swing.text.DefaultCaret does, as well as adding the
following niceties:
DefaultCaret)| 限定符和类型 | 字段和说明 |
|---|---|
static int |
BLOCK_BORDER_STYLE
The block border style.
|
static int |
BLOCK_STYLE
The block style.
|
static int |
MAX_STYLE
The maximum value of a caret style.
|
static int |
MIN_STYLE
The minimum value of a caret style.
|
static int |
THICK_VERTICAL_LINE_STYLE
A thicker vertical line (2 pixels instead of 1).
|
static int |
UNDERLINE_STYLE
The horizontal line style.
|
static int |
VERTICAL_LINE_STYLE
The vertical line style.
|
| 构造器和说明 |
|---|
ConfigurableCaret()
Creates the caret using
VERTICAL_LINE_STYLE. |
ConfigurableCaret(int style)
Constructs a new
ConfigurableCaret. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
damage(java.awt.Rectangle r)
Overridden to damage the correct width of the caret, since this caret
can be different sizes.
|
void |
deinstall(javax.swing.text.JTextComponent c)
Called when the UI is being removed from the
interface of a JTextComponent.
|
boolean |
getRoundedSelectionEdges()
Returns whether this caret's selection uses rounded edges.
|
protected javax.swing.text.Highlighter.HighlightPainter |
getSelectionPainter()
Gets the painter for the Highlighter.
|
int |
getStyle()
Gets the current style of this caret.
|
protected RTextArea |
getTextArea()
Gets the text editor component that this caret is bound to.
|
void |
install(javax.swing.text.JTextComponent c)
Installs this caret on a text component.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Called when the mouse is clicked.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Overridden to also focus the text component on right mouse clicks.
|
void |
paint(java.awt.Graphics g)
Paints the cursor.
|
void |
setRoundedSelectionEdges(boolean rounded)
Sets whether this caret's selection should have rounded edges.
|
void |
setSelectionVisible(boolean visible)
Overridden to always render the selection, even when the text component
loses focus.
|
void |
setStyle(int style)
Sets the style used when painting the caret.
|
addChangeListener, adjustVisibility, equals, fireStateChanged, focusGained, focusLost, getBlinkRate, getChangeListeners, getComponent, getDot, getDotBias, getListeners, getMagicCaretPosition, getMark, getMarkBias, getUpdatePolicy, isActive, isSelectionVisible, isVisible, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased, moveCaret, moveDot, moveDot, positionCaret, removeChangeListener, repaint, setBlinkRate, setDot, setDot, setMagicCaretPosition, setUpdatePolicy, setVisible, toStringadd, 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, unionadd, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, unionpublic static final int MIN_STYLE
public static final int VERTICAL_LINE_STYLE
public static final int UNDERLINE_STYLE
public static final int BLOCK_STYLE
public static final int BLOCK_BORDER_STYLE
public static final int THICK_VERTICAL_LINE_STYLE
public static final int MAX_STYLE
public ConfigurableCaret()
VERTICAL_LINE_STYLE.public ConfigurableCaret(int style)
ConfigurableCaret.style - The style to use when painting the caret. If this is
invalid, then VERTICAL_LINE_STYLE is used.protected void damage(java.awt.Rectangle r)
damage 在类中 javax.swing.text.DefaultCaretr - The current location of the caret.public void deinstall(javax.swing.text.JTextComponent c)
deinstall 在接口中 javax.swing.text.Caretdeinstall 在类中 javax.swing.text.DefaultCaretc - The text component. If this is not an
RTextArea, an Exception
will be thrown.Caret.deinstall(javax.swing.text.JTextComponent)protected RTextArea getTextArea()
RTextArea.public boolean getRoundedSelectionEdges()
setRoundedSelectionEdges(boolean)protected javax.swing.text.Highlighter.HighlightPainter getSelectionPainter()
getSelectionPainter 在类中 javax.swing.text.DefaultCaretpublic int getStyle()
setStyle(int)public void install(javax.swing.text.JTextComponent c)
install 在接口中 javax.swing.text.Caretinstall 在类中 javax.swing.text.DefaultCaretc - The text component. If this is not an RTextArea,
an Exception will be thrown.Caret.install(javax.swing.text.JTextComponent)public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked 在接口中 java.awt.event.MouseListenermouseClicked 在类中 javax.swing.text.DefaultCarete - the mouse eventMouseListener.mouseClicked(java.awt.event.MouseEvent)public void mousePressed(java.awt.event.MouseEvent e)
mousePressed 在接口中 java.awt.event.MouseListenermousePressed 在类中 javax.swing.text.DefaultCarete - The mouse event.public void paint(java.awt.Graphics g)
paint 在接口中 javax.swing.text.Caretpaint 在类中 javax.swing.text.DefaultCaretg - The graphics context in which to paint.public void setRoundedSelectionEdges(boolean rounded)
rounded - Whether it should have rounded edges.getRoundedSelectionEdges()public void setSelectionVisible(boolean visible)
setSelectionVisible 在接口中 javax.swing.text.CaretsetSelectionVisible 在类中 javax.swing.text.DefaultCaretvisible - Whether the selection should be visible. This parameter
is ignored.public void setStyle(int style)
style - The style to use. If this isn't one of
VERTICAL_LINE_STYLE, UNDERLINE_STYLE,
or BLOCK_STYLE, then
VERTICAL_LINE_STYLE is used.getStyle()