• Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing text with absolute coordinates  RSS feed

 
Lucas Rango
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I'm attempting my first steps on Java and I would like to know how can I print some plain text in a given position using the java.awt.print API. Thanks
 
Lucas Rango
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edit: these coordinates should be in centimeters
 
Carey Brown
Saloon Keeper
Posts: 3328
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll want to use Graphics2D.drawString(str,x,y). The X and Y coordinates are in pixels so if you want real world dimensions you'll have to scale it yourself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!