Java Doc for Text.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » lcdui » 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 » com.sun.midp.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.midp.lcdui.Text

Text
public class Text (Code)
Static method class use to draw and size text.


Field Summary
final public static  intHEIGHT
     Used as an index into the size[], for the height.
final public static  intHYPERLINK
     Draw a hyperlink for the text.
final public static  intINVERT
     INVERTED text color.
final public static  intNORMAL
     NORMAL text.
final public static  intPAINT_GET_CURSOR_INDEX
     When a paint occurs try to find the best value for the cursor index based on the x,y coordinates of the cursor.
final public static  intPAINT_HIDE_CURSOR
     Don't draw a cursor.
final public static  intPAINT_USE_CURSOR_INDEX
     When a paint occurs use the cursor index to know when to paint the cursor.
final public static  intTRUNCATE
     Truncate the text and put a "..." if the text doesn't fit the bounds.
final public static  intWIDTH
     Used as an index into the size[], for the width.
final public static  intX
     Used as an index into the size[], for the x.
final public static  intY
     Used as an index into the size[], for the y.


Method Summary
public static  intcanDrawStringPart(Graphics g, String str, int width)
     Given a string, determine the length of a substring that can be drawn within the current clipping area.
public static  voiddrawHyperLink(Graphics g, int x, int y, int w)
     Draws a hyperlink image.
public static  voiddrawTruncString(Graphics g, String str, Font font, int fgColor, int width)
     Draw the string within the specified width.
public static  voiddrawTruncStringShadowed(Graphics g, String text, Font font, int fgColor, int shdColor, int shdAlign, int titlew)
    
public static  intgetHeightForWidth(String str, Font font, int w, int offset)
     Gets the height in pixels to render the given string.
public static  voidgetSizeForWidth(int[] size, int availableWidth, String str, Font font, int offset)
     Gets the height in pixels and the width of the widest line in pixels for the given string, calculated based on the availableWidth.
public static  voidgetTwoStringsSize(int[] size, String firstStr, String secondStr, Font firstFont, Font secondFont, int width, int pad)
     Utility method to calculate the width and height in which 2 strings can fit given the strings, fonts and maximum width in which those strings should fit.
public static  intgetWidestLineWidth(String str, int offset, int width, Font font)
     Utility method to retrieve the length of the longest line of the text given the width.
public static  int[]initGNL(Font font, int w, int h, int options, int offset)
     Sets up a new inout structure used in various text methods.
public static  intpaint(Graphics g, String str, Font font, int fgColor, int fgHColor, int w, int h, int offset, int options, TextCursor cursor)
     Paints the text, linewrapping when necessary.
public static  intpaintLine(Graphics g, String str, Font font, int fgColor, int w, int h, TextCursor cursor, int offset)
     Paints the text in a single line, scrolling left or right as necessary to keep the cursor visible within the available width for the text.
public static  voidpaintText(TextInfo info, Graphics g, String str, Font font, int fgColor, int fgHColor, int w, int h, int offset, int options, TextCursor cursor)
     Paints text from a TextInfo structure.
public static  booleanupdateTextInfo(String str, Font font, int w, int h, int offset, int options, TextCursor cursor, TextInfo info)
     Creates a current TextInfo struct, linewraping text when necessary.

Field Detail
HEIGHT
final public static int HEIGHT(Code)
Used as an index into the size[], for the height.



HYPERLINK
final public static int HYPERLINK(Code)
Draw a hyperlink for the text.



INVERT
final public static int INVERT(Code)
INVERTED text color.



NORMAL
final public static int NORMAL(Code)
NORMAL text.



PAINT_GET_CURSOR_INDEX
final public static int PAINT_GET_CURSOR_INDEX(Code)
When a paint occurs try to find the best value for the cursor index based on the x,y coordinates of the cursor.



PAINT_HIDE_CURSOR
final public static int PAINT_HIDE_CURSOR(Code)
Don't draw a cursor.



PAINT_USE_CURSOR_INDEX
final public static int PAINT_USE_CURSOR_INDEX(Code)
When a paint occurs use the cursor index to know when to paint the cursor.



TRUNCATE
final public static int TRUNCATE(Code)
Truncate the text and put a "..." if the text doesn't fit the bounds.



WIDTH
final public static int WIDTH(Code)
Used as an index into the size[], for the width.



X
final public static int X(Code)
Used as an index into the size[], for the x.



Y
final public static int Y(Code)
Used as an index into the size[], for the y.





Method Detail
canDrawStringPart
public static int canDrawStringPart(Graphics g, String str, int width)(Code)
Given a string, determine the length of a substring that can be drawn within the current clipping area. If the whole string fits into the clip area, return the length of the string. Else, return the length of a substring (starting from the beginning of the original string) that can be drawn within the current clipping area before the truncation indicator. The truncation indicator, typically, ellipsis, is not included into the returned length.
Parameters:
  g - the Graphics to paint with
Parameters:
  str - the string to be painted
Parameters:
  width - the available width, including roomfor the truncation indicator either the length of str (if it fits into the clip area),or the length of the substring that can fit into the clip area(not including the truncation mark)



drawHyperLink
public static void drawHyperLink(Graphics g, int x, int y, int w)(Code)
Draws a hyperlink image.
Parameters:
  g - the graphics to use to draw the image
Parameters:
  x - the x location of the image
Parameters:
  y - the y location of the image
Parameters:
  w - the width of the hyperlink image



drawTruncString
public static void drawTruncString(Graphics g, String str, Font font, int fgColor, int width)(Code)
Draw the string within the specified width. If the string does not fit in the available width, it is truncated at the end, and a truncation indicator is displayed (usually, an ellipsis, but this can be changed). Use Graphics.translate(x,y) to specify the anchor point location (the alignment will be TOP|LEFT relative to 0,0).
Parameters:
  g - the Graphics to paint with
Parameters:
  str - the string to be painted
Parameters:
  font - the font to be used
Parameters:
  fgColor - the color to paint with
Parameters:
  width - the width available for painting



drawTruncStringShadowed
public static void drawTruncStringShadowed(Graphics g, String text, Font font, int fgColor, int shdColor, int shdAlign, int titlew)(Code)

Parameters:
  g - the Graphics to paint with
Parameters:
  text - the string to be painted
Parameters:
  font - the font to be used
Parameters:
  fgColor - foreground text color
Parameters:
  shdColor - shadow color
Parameters:
  shdAlign - shadow alignment
Parameters:
  titlew - width



getHeightForWidth
public static int getHeightForWidth(String str, Font font, int w, int offset)(Code)
Gets the height in pixels to render the given string.
Parameters:
  str - the string to render
Parameters:
  font - the font to use to render the string
Parameters:
  w - the available width for the string
Parameters:
  offset - the pixel offset for the first line the height in pixels required to render this string completely



getSizeForWidth
public static void getSizeForWidth(int[] size, int availableWidth, String str, Font font, int offset)(Code)
Gets the height in pixels and the width of the widest line in pixels for the given string, calculated based on the availableWidth. size[WIDTH] and size[HEIGHT] should be set by this method.
Parameters:
  size - The array that holds Item content size and location in Item internal bounds coordinate system.
Parameters:
  availableWidth - The width available for this Item
Parameters:
  str - the string to render
Parameters:
  font - the font to use to render the string
Parameters:
  offset - the pixel offset for the first line



getTwoStringsSize
public static void getTwoStringsSize(int[] size, String firstStr, String secondStr, Font firstFont, Font secondFont, int width, int pad)(Code)
Utility method to calculate the width and height in which 2 strings can fit given the strings, fonts and maximum width in which those strings should fit. Returned width is either the passed in width or a smaller one. The offset in pixels for the first string is 0, second string is laid out right after the first one with padding in between equal to the passed in value. The width in which both strings would fit given the maximum is returned in size[WIDTH]. The height in which both strings would fit is returned in size[HEIGHT];
Parameters:
  size - The array that returns contents size
Parameters:
  firstStr - the first string to use.
Parameters:
  secondStr - the first string to use.
Parameters:
  width - the available width for the text
Parameters:
  firstFont - the font to render the first string in
Parameters:
  secondFont - the font to render the second string in
Parameters:
  pad - the horizontal padding that should be used between strings



getWidestLineWidth
public static int getWidestLineWidth(String str, int offset, int width, Font font)(Code)
Utility method to retrieve the length of the longest line of the text given the width. this may not necessarily be the entire string if there are line breaks or word wraps.
Parameters:
  str - the String to use.
Parameters:
  offset - a pixel offset for the first line
Parameters:
  width - the available width for the text
Parameters:
  font - the font to render the text in the length of the longest line given the width



initGNL
public static int[] initGNL(Font font, int w, int h, int options, int offset)(Code)
Sets up a new inout structure used in various text methods.
Parameters:
  font - the font to use
Parameters:
  w - the available width for the text
Parameters:
  h - the available height for the text
Parameters:
  options - any of NORMAL | INVERT | HYPERLINK | TRUNCATE
Parameters:
  offset - the first line pixel offset initialized GNL_struct



paint
public static int paint(Graphics g, String str, Font font, int fgColor, int fgHColor, int w, int h, int offset, int options, TextCursor cursor)(Code)
Paints the text, linewrapping when necessary.
Parameters:
  g - the Graphics to use to paint with
Parameters:
  str - the text to paint
Parameters:
  font - the font to use to paint the text
Parameters:
  fgColor - foreground color
Parameters:
  fgHColor - foreground highlight color
Parameters:
  w - the available width for the text
Parameters:
  h - the available height for the text
Parameters:
  offset - the first line pixel offset
Parameters:
  options - any of NORMAL | INVERT | HYPERLINK | TRUNCATE
Parameters:
  cursor - text cursor object to use to draw vertical bar the width of the last line painted



paintLine
public static int paintLine(Graphics g, String str, Font font, int fgColor, int w, int h, TextCursor cursor, int offset)(Code)
Paints the text in a single line, scrolling left or right as necessary to keep the cursor visible within the available width for the text. The offset of the text after the paintLine call, whether modified or not, is returned.

If the cursor is null, signifying an uneditable TextField is being painted, the text will not be scrolled left or right, and the returned value will always equal the offset argument passed in to this method.
Parameters:
  g - the Graphics object to paint in
Parameters:
  str - the String to paint
Parameters:
  font - the font to use
Parameters:
  fgColor - foreground color
Parameters:
  w - the available width for the text
Parameters:
  h - the available height for the text
Parameters:
  cursor - TextCursor object to use for cursor placement
Parameters:
  offset - the pixel offset of the text (possibly negative) the current scroll offset




paintText
public static void paintText(TextInfo info, Graphics g, String str, Font font, int fgColor, int fgHColor, int w, int h, int offset, int options, TextCursor cursor)(Code)
Paints text from a TextInfo structure.
Parameters:
  info - the TextInfo struct
Parameters:
  g - the Graphics to paint with
Parameters:
  str - the text to paint
Parameters:
  font - the font to use in painting the text
Parameters:
  fgColor - foreground color
Parameters:
  fgHColor - foreground hilight color
Parameters:
  w - the available width for the text
Parameters:
  h - the available height for the text
Parameters:
  offset - the first line pixel offset
Parameters:
  options - any of NORMAL | INVERT | HYPERLINK | TRUNCATE
Parameters:
  cursor - text cursor object



updateTextInfo
public static boolean updateTextInfo(String str, Font font, int w, int h, int offset, int options, TextCursor cursor, TextInfo info)(Code)
Creates a current TextInfo struct, linewraping text when necessary. TextInfo struct is updated when str changes, or when scrolling happens. This method does not do any painting, but updates info to be current for use by the paint routine, paintText...
Parameters:
  str - the text to use
Parameters:
  font - the font to use for sizing
Parameters:
  w - the available width for the text
Parameters:
  h - the available height for the text
Parameters:
  offset - the pixel offset of the text (possibly negative)
Parameters:
  options - only TRUNCATE matters here
Parameters:
  cursor - text cursor object for cursor position
Parameters:
  info - TextInfo structure to fill true if successful, false if there was an error



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.