Java Doc for TextHitInfo.java in  » 6.0-JDK-Modules » j2me » java » awt » font » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.awt.font 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.font.TextHitInfo

TextHitInfo
final public class TextHitInfo (Code)
The TextHitInfo class represents a character position in a text model, and a bias, or "side," of the character. Biases are either leading (the left edge, for a left-to-right character) or trailing (the right edge, for a left-to-right character). Instances of TextHitInfo are used to specify caret and insertion positions within text.

For example, consider the text "abc". TextHitInfo.trailing(1) corresponds to the right side of the 'b' in the text.

TextHitInfo is used primarily by TextLayout and clients of TextLayout. Clients of TextLayout query TextHitInfo instances for an insertion offset, where new text is inserted into the text model. The insertion offset is equal to the character position in the TextHitInfo if the bias is leading, and one character after if the bias is trailing. The insertion offset for TextHitInfo.trailing(1) is 2.

Sometimes it is convenient to construct a TextHitInfo with the same insertion offset as an existing one, but on the opposite character. The getOtherHit method constructs a new TextHitInfo with the same insertion offset as an existing one, with a hit on the character on the other side of the insertion offset. Calling getOtherHit on trailing(1) would return leading(2). In general, getOtherHit for trailing(n) returns leading(n+1) and getOtherHit for leading(n) returns trailing(n-1).

Example:

Converting a graphical point to an insertion point within a text model

 TextLayout layout = ...;
 Point2D.Float hitPoint = ...;
 TextHitInfo hitInfo = layout.hitTestChar(hitPoint.x, hitPoint.y);
 int insPoint = hitInfo.getInsertionIndex();
 // insPoint is relative to layout;  may need to adjust for use 
 // in a text model
 

See Also:   TextLayout




Method Summary
public static  TextHitInfoafterOffset(int offset)
     Creates a TextHitInfo at the specified offset, associated with the character after the offset.
public static  TextHitInfobeforeOffset(int offset)
     Creates a TextHitInfo at the specified offset, associated with the character before the offset.
public  booleanequals(Object obj)
     Returns true if the specified Object is a TextHitInfo and equals this TextHitInfo.
public  intgetCharIndex()
     Returns the index of the character hit.
public  intgetInsertionIndex()
     Returns the insertion index.
public  TextHitInfogetOffsetHit(int delta)
     Creates a TextHitInfo whose character index is offset by delta from the charIndex of this TextHitInfo.
public  TextHitInfogetOtherHit()
     Creates a TextHitInfo on the other side of the insertion point.
public  inthashCode()
     Returns the hash code.
public  booleanisLeadingEdge()
     Returns true if the leading edge of the character was hit.
public static  TextHitInfoleading(int charIndex)
     Creates a TextHitInfo on the leading edge of the character at the specified charIndex.
public  StringtoString()
     Returns a String representing the hit for debugging use only.
public static  TextHitInfotrailing(int charIndex)
     Creates a hit on the trailing edge of the character at the specified charIndex.



Method Detail
afterOffset
public static TextHitInfo afterOffset(int offset)(Code)
Creates a TextHitInfo at the specified offset, associated with the character after the offset.
Parameters:
  offset - an offset associated with the character afterthe offset a TextHitInfo at the specified offset.



beforeOffset
public static TextHitInfo beforeOffset(int offset)(Code)
Creates a TextHitInfo at the specified offset, associated with the character before the offset.
Parameters:
  offset - an offset associated with the character beforethe offset a TextHitInfo at the specified offset.



equals
public boolean equals(Object obj)(Code)
Returns true if the specified Object is a TextHitInfo and equals this TextHitInfo.
Parameters:
  obj - the Object to test for equality true if the specified Objectequals this TextHitInfo; false otherwise.



getCharIndex
public int getCharIndex()(Code)
Returns the index of the character hit. the index of the character hit.



getInsertionIndex
public int getInsertionIndex()(Code)
Returns the insertion index. This is the character index if the leading edge of the character was hit, and one greater than the character index if the trailing edge was hit. the insertion index.



getOffsetHit
public TextHitInfo getOffsetHit(int delta)(Code)
Creates a TextHitInfo whose character index is offset by delta from the charIndex of this TextHitInfo. This TextHitInfo remains unchanged.
Parameters:
  delta - the value to offset this charIndex a TextHitInfo whose charIndex isoffset by delta from the charIndex of this TextHitInfo.



getOtherHit
public TextHitInfo getOtherHit()(Code)
Creates a TextHitInfo on the other side of the insertion point. This TextHitInfo remains unchanged. a TextHitInfo on the other side of the insertion point.



hashCode
public int hashCode()(Code)
Returns the hash code. the hash code of this TextHitInfo, which isalso the charIndex of this TextHitInfo.



isLeadingEdge
public boolean isLeadingEdge()(Code)
Returns true if the leading edge of the character was hit. true if the leading edge of the character washit; false otherwise.



leading
public static TextHitInfo leading(int charIndex)(Code)
Creates a TextHitInfo on the leading edge of the character at the specified charIndex.
Parameters:
  charIndex - the index of the character hit a TextHitInfo on the leading edge of thecharacter at the specified charIndex.



toString
public String toString()(Code)
Returns a String representing the hit for debugging use only. a String representing thisTextHitInfo.



trailing
public static TextHitInfo trailing(int charIndex)(Code)
Creates a hit on the trailing edge of the character at the specified charIndex.
Parameters:
  charIndex - the index of the character hit a TextHitInfo on the trailing edge of thecharacter at the specified charIndex.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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