javax.swing.text

Class DefaultCaret

Implemented Interfaces:
Caret, Cloneable, EventListener, FocusListener, MouseListener, MouseMotionListener, Serializable, Shape
Known Direct Subclasses:
BasicTextUI.BasicCaret

public class DefaultCaret
extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener

See Also:
Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D

Rectangle2D.Double, Rectangle2D.Float

Field Summary

protected ChangeEvent
changeEvent
protected EventListenerList
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

Method Summary

void
addChangeListener(ChangeListener listener)
void
deinstall(JTextComponent c)
protected void
fireStateChanged()
void
focusGained(FocusEvent event)
This method is called when a component gains the keyboard focus.
void
focusLost(FocusEvent event)
This method is invoked when a component loses the keyboard focus.
int
getBlinkRate()
ChangeListener[]
getChangeListeners()
protected JTextComponent
getComponent()
int
getDot()
EventListener[]
getListeners(Class listenerType)
Point
getMagicCaretPosition()
int
getMark()
protected Highlighter.HighlightPainter
getSelectionPainter()
void
install(JTextComponent c)
boolean
isSelectionVisible()
boolean
isVisible()
void
mouseClicked(MouseEvent event)
This method is called when the mouse is clicked (pressed and released in short succession) on a component.
void
mouseDragged(MouseEvent event)
This method is called when the mouse is moved over a component while a button has been pressed.
void
mouseEntered(MouseEvent event)
This method is called when the mouse enters a component.
void
mouseExited(MouseEvent event)
This method is called when the mouse exits a component.
void
mouseMoved(MouseEvent event)
This method is called when the mouse is moved over a component while no button is pressed.
void
mousePressed(MouseEvent event)
This method is called when the mouse is pressed over a component.
void
mouseReleased(MouseEvent event)
This method is called when the mouse is released over a component.
protected void
moveCaret(MouseEvent event)
void
moveDot(int dot)
void
paint(Graphics g)
protected void
positionCaret(MouseEvent event)
void
removeChangeListener(ChangeListener listener)
protected void
repaint()
void
setBlinkRate(int rate)
void
setDot(int dot)
void
setMagicCaretPosition(Point p)
void
setSelectionVisible(boolean v)
void
setVisible(boolean v)

Methods inherited from class java.awt.Rectangle

add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, 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, union

Methods inherited from class java.awt.geom.Rectangle2D

add, add, add, contains, contains, createIntersection, createUnion, equals, getBounds2D, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, outcode, setFrame, setRect, setRect, union

Methods inherited from class java.awt.geom.RectangularShape

clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getHeight, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, getWidth, getX, getY, intersects, isEmpty, setFrame, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

changeEvent

protected ChangeEvent changeEvent


listenerList

protected EventListenerList listenerList

Method Details

addChangeListener

public void addChangeListener(ChangeListener listener)
Specified by:
addChangeListener in interface Caret


deinstall

public void deinstall(JTextComponent c)
Specified by:
deinstall in interface Caret


fireStateChanged

protected void fireStateChanged()


focusGained

public void focusGained(FocusEvent event)
This method is called when a component gains the keyboard focus.
Specified by:
focusGained in interface FocusListener

Parameters:
event - the FocusEvent indicating that focus was gained


focusLost

public void focusLost(FocusEvent event)
This method is invoked when a component loses the keyboard focus.
Specified by:
focusLost in interface FocusListener

Parameters:
event - the FocusEvent indicating that focus was lost


getBlinkRate

public int getBlinkRate()
Specified by:
getBlinkRate in interface Caret


getChangeListeners

public ChangeListener[] getChangeListeners()


getComponent

protected final JTextComponent getComponent()


getDot

public int getDot()
Specified by:
getDot in interface Caret


getListeners

public EventListener[] getListeners(Class listenerType)


getMagicCaretPosition

public Point getMagicCaretPosition()
Specified by:
getMagicCaretPosition in interface Caret


getMark

public int getMark()
Specified by:
getMark in interface Caret


getSelectionPainter

protected Highlighter.HighlightPainter getSelectionPainter()


install

public void install(JTextComponent c)
Specified by:
install in interface Caret


isSelectionVisible

public boolean isSelectionVisible()
Specified by:
isSelectionVisible in interface Caret


isVisible

public boolean isVisible()
Specified by:
isVisible in interface Caret


mouseClicked

public void mouseClicked(MouseEvent event)
This method is called when the mouse is clicked (pressed and released in short succession) on a component.
Specified by:
mouseClicked in interface MouseListener

Parameters:
event - the MouseEvent indicating the click


mouseDragged

public void mouseDragged(MouseEvent event)
This method is called when the mouse is moved over a component while a button has been pressed.
Specified by:
mouseDragged in interface MouseMotionListener

Parameters:
event - the MouseEvent indicating the motion


mouseEntered

public void mouseEntered(MouseEvent event)
This method is called when the mouse enters a component.
Specified by:
mouseEntered in interface MouseListener

Parameters:
event - the MouseEvent for the entry


mouseExited

public void mouseExited(MouseEvent event)
This method is called when the mouse exits a component.
Specified by:
mouseExited in interface MouseListener

Parameters:
event - the MouseEvent for the exit


mouseMoved

public void mouseMoved(MouseEvent event)
This method is called when the mouse is moved over a component while no button is pressed.
Specified by:
mouseMoved in interface MouseMotionListener

Parameters:
event - the MouseEvent indicating the motion


mousePressed

public void mousePressed(MouseEvent event)
This method is called when the mouse is pressed over a component.
Specified by:
mousePressed in interface MouseListener

Parameters:
event - the MouseEvent for the press


mouseReleased

public void mouseReleased(MouseEvent event)
This method is called when the mouse is released over a component.
Specified by:
mouseReleased in interface MouseListener

Parameters:
event - the MouseEvent for the release


moveCaret

protected void moveCaret(MouseEvent event)


moveDot

public void moveDot(int dot)
Specified by:
moveDot in interface Caret


paint

public void paint(Graphics g)
Specified by:
paint in interface Caret


positionCaret

protected void positionCaret(MouseEvent event)


removeChangeListener

public void removeChangeListener(ChangeListener listener)
Specified by:
removeChangeListener in interface Caret


repaint

protected final void repaint()


setBlinkRate

public void setBlinkRate(int rate)
Specified by:
setBlinkRate in interface Caret


setDot

public void setDot(int dot)
Specified by:
setDot in interface Caret


setMagicCaretPosition

public void setMagicCaretPosition(Point p)
Specified by:
setMagicCaretPosition in interface Caret


setSelectionVisible

public void setSelectionVisible(boolean v)
Specified by:
setSelectionVisible in interface Caret


setVisible

public void setVisible(boolean v)
Specified by:
setVisible in interface Caret


DefaultCaret.java -- Copyright (C) 2002, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.