All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.text.JInsertPosition

java.lang.Object
   |
   +----java.awt.Component
           |
           +----com.sun.java.swing.text.JInsertPosition

public class JInsertPosition
extends Component
implements InsertPosition, DocumentListener, ActionListener
An implementation of InsertPosition for a view that maps over the entire portion of the model represented (ie there are no holes in the area represented) and renders the insert position as a vertical line. The foreground color of the component is the color of the caret and the background color of the component is the color of the selections made by moving the caret. The Highlighter implementation of the associated UI is used to actually render the selection.

See Also:
InsertPosition

Variable Index

 o changeEvent
 o changeListener

Constructor Index

 o JInsertPosition(Color, Color)
Construct a caret with given color settings.

Method Index

 o actionPerformed(ActionEvent)
Invoked when the blink timer fires
 o addChangeListener(ChangeListener)
 o adjustHorizontally(BoundedRangeModel, Rectangle, Rectangle)
Scroll the associated view horizontally to make the caret visible.
 o adjustVertically(BoundedRangeModel, Rectangle, Rectangle)
Scroll the associated view vertically to make the caret visible.
 o changedUpdate(DocumentEvent)
 o damage(Rectangle)
Damages the area surrounding the caret to cause it to be repainted.
 o deinstall(JTextComponent)
 o getActions()
 o getDot()
 o getMark()
 o insertUpdate(DocumentEvent)
Update the dot and mark if they were changed by the insertion.
 o install(JTextComponent)
 o isVisible()
 o moveDot(int)
 o paint(Graphics)
Renders the caret as a vertical line.
 o removeChangeListener(ChangeListener)
 o removeUpdate(DocumentEvent)
Update the dot and mark if they were changed by the removal.
 o setBlinkRate(int)
 o setDot(int)
 o setVisible(boolean)
If the caret is flashing, the flashing is terminated.

Variables

 o changeListener
 protected ChangeListener changeListener
 o changeEvent
 protected ChangeEvent changeEvent

Constructors

 o JInsertPosition
 public JInsertPosition(Color c,
                        Color h)
Construct a caret with given color settings.

Parameters:
c - The caret color
h - The highlight color for selections (ie. indicating the range spaned by the dot/mark combination).

Methods

 o damage
 protected void damage(Rectangle r)
Damages the area surrounding the caret to cause it to be repainted. If paint() is reimplemented, this method should also be reimplemented.

Parameters:
r - The current location of the caret.
See Also:
paint
 o adjustHorizontally
 protected void adjustHorizontally(BoundedRangeModel vis,
                                   Rectangle oloc,
                                   Rectangle nloc)
Scroll the associated view horizontally to make the caret visible. Since how this should be done is somewhat of a policy, this method can be reimplemented to change the behavior. By default an attempt will be made to scroll the view so the caret is in it's previous location.

 o adjustVertically
 protected void adjustVertically(BoundedRangeModel vis,
                                 Rectangle oloc,
                                 Rectangle nloc)
Scroll the associated view vertically to make the caret visible. Since how this should be done is somewhat of a policy, this method can be reimplemented to change the behavior. By default an attempt will be made to scroll the view so the caret is in it's previous location.

 o paint
 public void paint(Graphics g)
Renders the caret as a vertical line. If this is reimplemented the damage method should also be reimplemented as it assumes the shape of the caret is a vertical line.

Overrides:
paint in class Component
See Also:
damage
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Invoked when the blink timer fires

 o insertUpdate
 public void insertUpdate(DocumentEvent e)
Update the dot and mark if they were changed by the insertion.

See Also:
insertUpdate
 o removeUpdate
 public void removeUpdate(DocumentEvent e)
Update the dot and mark if they were changed by the removal.

See Also:
removeUpdate
 o changedUpdate
 public void changedUpdate(DocumentEvent e)
See Also:
changedUpdate
 o install
 public void install(JTextComponent c)
See Also:
install
 o deinstall
 public void deinstall(JTextComponent c)
See Also:
deinstall
 o addChangeListener
 public void addChangeListener(ChangeListener l)
See Also:
addChangeListener
 o removeChangeListener
 public void removeChangeListener(ChangeListener l)
See Also:
removeChangeListener
 o isVisible
 public boolean isVisible()
Overrides:
isVisible in class Component
See Also:
isVisible
 o setVisible
 public void setVisible(boolean e)
If the caret is flashing, the flashing is terminated. If the caret is not flashing, the flashing is started.

Overrides:
setVisible in class Component
See Also:
setVisible
 o setBlinkRate
 public void setBlinkRate(int rate)
See Also:
setBlinkRate
 o getDot
 public int getDot()
See Also:
getDot
 o getMark
 public int getMark()
See Also:
getMark
 o setDot
 public void setDot(int dot)
See Also:
setDot
 o moveDot
 public void moveDot(int dot)
See Also:
moveDot
 o getActions
 public Action[] getActions()
See Also:
getActions

All Packages  Class Hierarchy  This Package  Previous  Next  Index