Java Doc for Caret.java in  » 6.0-JDK-Core » swing » javax » swing » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.swing.text.Caret

All known Subclasses:   javax.swing.text.DefaultCaret,
Caret
public interface Caret (Code)
A place within a document view that represents where things can be inserted into the document model. A caret has a position in the document referred to as a dot. The dot is where the caret is currently located in the model. There is a second position maintained by the caret that represents the other end of a selection called mark. If there is no selection the dot and mark will be equal. If a selection exists, the two values will be different.

The dot can be placed by either calling setDot or moveDot. Setting the dot has the effect of removing any selection that may have previously existed. The dot and mark will be equal. Moving the dot has the effect of creating a selection as the mark is left at whatever position it previously had.
author:
   Timothy Prinzing
version:
   1.38 05/05/07





Method Summary
public  voidaddChangeListener(ChangeListener l)
     Adds a listener to track whenever the caret position has been changed.
public  voiddeinstall(JTextComponent c)
     Called when the UI is being removed from the interface of a JTextComponent.
public  intgetBlinkRate()
     Gets the blink rate of the caret.
public  intgetDot()
     Fetches the current position of the caret.
public  PointgetMagicCaretPosition()
     Gets the current caret visual location.
public  intgetMark()
     Fetches the current position of the mark.
public  voidinstall(JTextComponent c)
     Called when the UI is being installed into the interface of a JTextComponent.
public  booleanisSelectionVisible()
     Determines if the selection is currently visible.
public  booleanisVisible()
     Determines if the caret is currently visible.
public  voidmoveDot(int dot)
     Moves the caret position (dot) to some other position, leaving behind the mark.
public  voidpaint(Graphics g)
     Renders the caret.
public  voidremoveChangeListener(ChangeListener l)
     Removes a listener that was tracking caret position changes.
public  voidsetBlinkRate(int rate)
     Sets the blink rate of the caret.
public  voidsetDot(int dot)
     Sets the caret position to some position.
public  voidsetMagicCaretPosition(Point p)
     Set the current caret visual location.
public  voidsetSelectionVisible(boolean v)
    
public  voidsetVisible(boolean v)
     Sets the visibility of the caret.



Method Detail
addChangeListener
public void addChangeListener(ChangeListener l)(Code)
Adds a listener to track whenever the caret position has been changed.
Parameters:
  l - the change listener



deinstall
public void deinstall(JTextComponent c)(Code)
Called when the UI is being removed from the interface of a JTextComponent. This is used to unregister any listeners that were attached.
Parameters:
  c - the JTextComponent



getBlinkRate
public int getBlinkRate()(Code)
Gets the blink rate of the caret. This determines if and how fast the caret blinks, commonly used as one way to attract attention to the caret. the delay in milliseconds >= 0. If this iszero the caret will not blink.



getDot
public int getDot()(Code)
Fetches the current position of the caret. the position >= 0



getMagicCaretPosition
public Point getMagicCaretPosition()(Code)
Gets the current caret visual location. the visual position.
See Also:   Caret.setMagicCaretPosition



getMark
public int getMark()(Code)
Fetches the current position of the mark. If there is a selection, the mark will not be the same as the dot. the position >= 0



install
public void install(JTextComponent c)(Code)
Called when the UI is being installed into the interface of a JTextComponent. This can be used to gain access to the model that is being navigated by the implementation of this interface.
Parameters:
  c - the JTextComponent



isSelectionVisible
public boolean isSelectionVisible()(Code)
Determines if the selection is currently visible. true if the caret is visible else false



isVisible
public boolean isVisible()(Code)
Determines if the caret is currently visible. true if the caret is visible else false



moveDot
public void moveDot(int dot)(Code)
Moves the caret position (dot) to some other position, leaving behind the mark. This is useful for making selections.
Parameters:
  dot - the new position to move the caret to >= 0



paint
public void paint(Graphics g)(Code)
Renders the caret. This method is called by UI classes.
Parameters:
  g - the graphics context



removeChangeListener
public void removeChangeListener(ChangeListener l)(Code)
Removes a listener that was tracking caret position changes.
Parameters:
  l - the change listener



setBlinkRate
public void setBlinkRate(int rate)(Code)
Sets the blink rate of the caret. This determines if and how fast the caret blinks, commonly used as one way to attract attention to the caret.
Parameters:
  rate - the delay in milliseconds >= 0. If this iszero the caret will not blink.



setDot
public void setDot(int dot)(Code)
Sets the caret position to some position. This causes the mark to become the same as the dot, effectively setting the selection range to zero.

If the parameter is negative or beyond the length of the document, the caret is placed at the beginning or at the end, respectively.
Parameters:
  dot - the new position to set the caret to




setMagicCaretPosition
public void setMagicCaretPosition(Point p)(Code)
Set the current caret visual location. This can be used when moving between lines that have uneven end positions (such as when caret up or down actions occur). If text flows left-to-right or right-to-left the x-coordinate will indicate the desired navigation location for vertical movement. If the text flow is top-to-bottom, the y-coordinate will indicate the desired navigation location for horizontal movement.
Parameters:
  p - the Point to use for the saved position. Thiscan be null to indicate there is no visual location.



setSelectionVisible
public void setSelectionVisible(boolean v)(Code)
Sets the visibility of the selection
Parameters:
  v - true if the caret should be shown,and false if the caret should be hidden



setVisible
public void setVisible(boolean v)(Code)
Sets the visibility of the caret.
Parameters:
  v - true if the caret should be shown,and false if the caret should be hidden



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.