Java 2D Graphics Text

Java examples for 2D Graphics:Text


Click the following links for the tutorial for 2D Graphics and Text.

  1. Display strings in different fonts and colors.
  2. Map a graphical location to a character position within text in Java 2D
  3. Java 2D Define and render the graphics and text
  4. Java 2D Create Antialiased Text
  5. Java 2D Text Respond to left and right arrow keys with TextLayout
  6. Java 2D Text Draw text with font Text Attribute
  7. Java Map a graphical location to a character position within Unicode text
  8. Layout paragraph text by Breaking text to next line with LineBreakMeasurer and TextLayout

  9. Java Select text with TextLayout
  10. Java Draw simple text string
  11. This example displays ASCII digits, 0 through 9, as Arabit digits
  12. Create TextLayout from TextAttribute and Layout String
  13. Paint text with various font using FontRenderContext
  14. Create Bidirection Text display
  15. Word boundary break with BreakIterator
  16. Colored Hello World

  17. Getting the Dimensions of Text From within a component
  18. Getting the Dimensions of Text From within the paint() method
  19. Getting the Shape from the Outline of Text
  20. Drawing Simple Text
  21. Drawing a Paragraph of Text
  22. Drawing Rotated Text
  23. Draw a given String to a Graphics2D object
  24. Draw a given String to a graphic object as big as possible but still stay within given dimension.
  25. Draw a given String to a graphic object centered
  26. Draw string with alignment
  27. draw Missing Texture
  28. Draw a string of text centered in the given Graphics object.
  29. Draws a line, using the current color, between the points in this graphics context's coordinate system.
  30. Draw a text in the center of the bounds.
  31. Calculate the start point for drawing a TextLayout.
  32. Calculate the origin points that are used to draw a list of TextLayouts.
  33. get Text Height
  34. get Text Width
  35. Draws text in red with appropriate word wrap.
  36. draw Centered String
  37. draw String
  38. draw Shadow Text
  39. Draws the specified string on the specified graphics wrapped to the specified width.
  40. Enables anti-aliasing for both text and other elements for the supplied 'g' Graphics object.
  41. draw Centered Text
  42. draw Text
  43. get Text Bounds
  44. centering Text
  45. Generates a TexturePaint of the given size, using the given text as a pattern.
  46. get Text Color from background color
  47. highlight Text
  48. shadow Text
  49. measure Text Pixels
  50. draw String Centered At
  51. measure String Height
  52. measure String Width
  53. draw Wrapped String
  54. Draws the specified string with a drop shadow
  55. Draws a string centered at a certain x-coordinate
  56. draw String Align Center
  57. draw String within range
  58. draw Trimmed String
  59. Attempts to parse an RGB triplet or an RGBA quadruplet from the string.
  60. draw String Array
  61. performs the annoying calculation required for centering text in a box of size d.
  62. Creates a multiline text outline shape using a center alignment