Java Doc for TextUtilities.java in  » Graphic-Library » jcommon-components » org » jfree » text » 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 » Graphic Library » jcommon components » org.jfree.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jfree.text.TextUtilities

TextUtilities
public class TextUtilities (Code)
Some utility methods for working with text.
author:
   David Gilbert


Field Summary
final protected static  LogContextlogger
     Access to logging facilities.


Method Summary
public static  ShapecalculateRotatedStringBounds(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor)
     Returns a shape that represents the bounds of the string after the specified rotation has been applied.
Parameters:
  text - the text (null permitted).
Parameters:
  g2 - the graphics device.
Parameters:
  x - the x coordinate for the anchor point.
Parameters:
  y - the y coordinate for the anchor point.
Parameters:
  textAnchor - the text anchor.
Parameters:
  angle - the angle.
Parameters:
  rotationAnchor - the rotation anchor.
public static  ShapecalculateRotatedStringBounds(String text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY)
     Returns a shape that represents the bounds of the string after the specified rotation has been applied.
Parameters:
  text - the text (null permitted).
Parameters:
  g2 - the graphics device.
Parameters:
  textX - the x coordinate for the text.
Parameters:
  textY - the y coordinate for the text.
Parameters:
  angle - the angle.
Parameters:
  rotateX - the x coordinate for the rotation point.
Parameters:
  rotateY - the y coordinate for the rotation point.
public static  TextBlockcreateTextBlock(String text, Font font, Paint paint)
     Creates a TextBlock from a String.
public static  TextBlockcreateTextBlock(String text, Font font, Paint paint, float maxWidth, TextMeasurer measurer)
     Creates a new text block from the given string, breaking the text into lines so that the maxWidth value is respected.
Parameters:
  text - the text.
Parameters:
  font - the font.
Parameters:
  paint - the paint.
Parameters:
  maxWidth - the maximum width for each line.
Parameters:
  measurer - the text measurer.
public static  TextBlockcreateTextBlock(String text, Font font, Paint paint, float maxWidth, int maxLines, TextMeasurer measurer)
     Creates a new text block from the given string, breaking the text into lines so that the maxWidth value is respected.
Parameters:
  text - the text.
Parameters:
  font - the font.
Parameters:
  paint - the paint.
Parameters:
  maxWidth - the maximum width for each line.
Parameters:
  maxLines - the maximum number of lines.
Parameters:
  measurer - the text measurer.
public static  Rectangle2DdrawAlignedString(String text, Graphics2D g2, float x, float y, TextAnchor anchor)
     Draws a string such that the specified anchor point is aligned to the given (x, y) location.
Parameters:
  text - the text.
Parameters:
  g2 - the graphics device.
Parameters:
  x - the x coordinate (Java 2D).
Parameters:
  y - the y coordinate (Java 2D).
Parameters:
  anchor - the anchor location.
public static  voiddrawRotatedString(String text, Graphics2D g2, double angle, float x, float y)
     A utility method for drawing rotated text.
public static  voiddrawRotatedString(String text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY)
     A utility method for drawing rotated text.
public static  voiddrawRotatedString(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, float rotationX, float rotationY)
     Draws a string that is aligned by one anchor point and rotated about another anchor point.
public static  voiddrawRotatedString(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor)
     Draws a string that is aligned by one anchor point and rotated about another anchor point.
public static  Rectangle2DgetTextBounds(String text, Graphics2D g2, FontMetrics fm)
     Returns the bounds for the specified text.
Parameters:
  text - the text (null permitted).
Parameters:
  g2 - the graphics context (not null).
Parameters:
  fm - the font metrics (not null).
public static  booleangetUseFontMetricsGetStringBounds()
     Returns the flag that controls whether the FontMetrics.getStringBounds() method is used or not.
public static  booleanisUseDrawRotatedStringWorkaround()
    
public static  voidsetUseDrawRotatedStringWorkaround(boolean use)
     Sets the flag that controls whether or not a workaround is used for drawing rotated strings.
public static  voidsetUseFontMetricsGetStringBounds(boolean use)
     Sets the flag that controls whether the FontMetrics.getStringBounds() method is used or not.

Field Detail
logger
final protected static LogContext logger(Code)
Access to logging facilities.





Method Detail
calculateRotatedStringBounds
public static Shape calculateRotatedStringBounds(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor)(Code)
Returns a shape that represents the bounds of the string after the specified rotation has been applied.
Parameters:
  text - the text (null permitted).
Parameters:
  g2 - the graphics device.
Parameters:
  x - the x coordinate for the anchor point.
Parameters:
  y - the y coordinate for the anchor point.
Parameters:
  textAnchor - the text anchor.
Parameters:
  angle - the angle.
Parameters:
  rotationAnchor - the rotation anchor. The bounds (possibly null).



calculateRotatedStringBounds
public static Shape calculateRotatedStringBounds(String text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY)(Code)
Returns a shape that represents the bounds of the string after the specified rotation has been applied.
Parameters:
  text - the text (null permitted).
Parameters:
  g2 - the graphics device.
Parameters:
  textX - the x coordinate for the text.
Parameters:
  textY - the y coordinate for the text.
Parameters:
  angle - the angle.
Parameters:
  rotateX - the x coordinate for the rotation point.
Parameters:
  rotateY - the y coordinate for the rotation point. The bounds (null if text is null or has zero length).



createTextBlock
public static TextBlock createTextBlock(String text, Font font, Paint paint)(Code)
Creates a TextBlock from a String. Line breaks are added where the String contains '\n' characters.
Parameters:
  text - the text.
Parameters:
  font - the font.
Parameters:
  paint - the paint. A text block.



createTextBlock
public static TextBlock createTextBlock(String text, Font font, Paint paint, float maxWidth, TextMeasurer measurer)(Code)
Creates a new text block from the given string, breaking the text into lines so that the maxWidth value is respected.
Parameters:
  text - the text.
Parameters:
  font - the font.
Parameters:
  paint - the paint.
Parameters:
  maxWidth - the maximum width for each line.
Parameters:
  measurer - the text measurer. A text block.



createTextBlock
public static TextBlock createTextBlock(String text, Font font, Paint paint, float maxWidth, int maxLines, TextMeasurer measurer)(Code)
Creates a new text block from the given string, breaking the text into lines so that the maxWidth value is respected.
Parameters:
  text - the text.
Parameters:
  font - the font.
Parameters:
  paint - the paint.
Parameters:
  maxWidth - the maximum width for each line.
Parameters:
  maxLines - the maximum number of lines.
Parameters:
  measurer - the text measurer. A text block.



drawAlignedString
public static Rectangle2D drawAlignedString(String text, Graphics2D g2, float x, float y, TextAnchor anchor)(Code)
Draws a string such that the specified anchor point is aligned to the given (x, y) location.
Parameters:
  text - the text.
Parameters:
  g2 - the graphics device.
Parameters:
  x - the x coordinate (Java 2D).
Parameters:
  y - the y coordinate (Java 2D).
Parameters:
  anchor - the anchor location. The text bounds (adjusted for the text position).



drawRotatedString
public static void drawRotatedString(String text, Graphics2D g2, double angle, float x, float y)(Code)
A utility method for drawing rotated text.

A common rotation is -Math.PI/2 which draws text 'vertically' (with the top of the characters on the left).
Parameters:
  text - the text.
Parameters:
  g2 - the graphics device.
Parameters:
  angle - the angle of the (clockwise) rotation (in radians).
Parameters:
  x - the x-coordinate.
Parameters:
  y - the y-coordinate.




drawRotatedString
public static void drawRotatedString(String text, Graphics2D g2, float textX, float textY, double angle, float rotateX, float rotateY)(Code)
A utility method for drawing rotated text.

A common rotation is -Math.PI/2 which draws text 'vertically' (with the top of the characters on the left).
Parameters:
  text - the text.
Parameters:
  g2 - the graphics device.
Parameters:
  textX - the x-coordinate for the text (before rotation).
Parameters:
  textY - the y-coordinate for the text (before rotation).
Parameters:
  angle - the angle of the (clockwise) rotation (in radians).
Parameters:
  rotateX - the point about which the text is rotated.
Parameters:
  rotateY - the point about which the text is rotated.




drawRotatedString
public static void drawRotatedString(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, float rotationX, float rotationY)(Code)
Draws a string that is aligned by one anchor point and rotated about another anchor point.
Parameters:
  text - the text.
Parameters:
  g2 - the graphics device.
Parameters:
  x - the x-coordinate for positioning the text.
Parameters:
  y - the y-coordinate for positioning the text.
Parameters:
  textAnchor - the text anchor.
Parameters:
  angle - the rotation angle.
Parameters:
  rotationX - the x-coordinate for the rotation anchor point.
Parameters:
  rotationY - the y-coordinate for the rotation anchor point.



drawRotatedString
public static void drawRotatedString(String text, Graphics2D g2, float x, float y, TextAnchor textAnchor, double angle, TextAnchor rotationAnchor)(Code)
Draws a string that is aligned by one anchor point and rotated about another anchor point.
Parameters:
  text - the text.
Parameters:
  g2 - the graphics device.
Parameters:
  x - the x-coordinate for positioning the text.
Parameters:
  y - the y-coordinate for positioning the text.
Parameters:
  textAnchor - the text anchor.
Parameters:
  angle - the rotation angle (in radians).
Parameters:
  rotationAnchor - the rotation anchor.



getTextBounds
public static Rectangle2D getTextBounds(String text, Graphics2D g2, FontMetrics fm)(Code)
Returns the bounds for the specified text.
Parameters:
  text - the text (null permitted).
Parameters:
  g2 - the graphics context (not null).
Parameters:
  fm - the font metrics (not null). The text bounds (null if the text argument is null).



getUseFontMetricsGetStringBounds
public static boolean getUseFontMetricsGetStringBounds()(Code)
Returns the flag that controls whether the FontMetrics.getStringBounds() method is used or not. If you are having trouble with label alignment or positioning, try changing the value of this flag. A boolean.



isUseDrawRotatedStringWorkaround
public static boolean isUseDrawRotatedStringWorkaround()(Code)



setUseDrawRotatedStringWorkaround
public static void setUseDrawRotatedStringWorkaround(boolean use)(Code)
Sets the flag that controls whether or not a workaround is used for drawing rotated strings. The related bug is on Sun's bug parade (id 4312117) and the workaround involves using a TextLayout instance to draw the text instead of calling the drawString() method in the Graphics2D class.
Parameters:
  use - the new flag value.



setUseFontMetricsGetStringBounds
public static void setUseFontMetricsGetStringBounds(boolean use)(Code)
Sets the flag that controls whether the FontMetrics.getStringBounds() method is used or not. If you are having trouble with label alignment or positioning, try changing the value of this flag.
Parameters:
  use - the flag.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(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.