Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change text orientation on canvas

 
Iason Dimitrakopoulos
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I use a normal AWT Canvas class and i want to make text display verticaly starting from the bottom and going up.. how would that be possible ? i dont want to use a label, just g.drawString()
 
Iason Dimitrakopoulos
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone?
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search this forum. This question has been asked at least 3 times in the past week.
 
Iason Dimitrakopoulos
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did thanks
i've used graphics 2d to rotate the text but now i have encountered a second problem. i rotate the graphics to draw the tilted text

however r.x and r.y are x,y values in a Rectangle prior to rotating the graphics. I want to place the text exactly at that point but not the point that has been rotated, is there a mathematical formula to go back to the original point? i hope someone understands something from this because my english isnt so good
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I understand. You want the string to start at x,y (i.e. 1,2), but once the graphics object is rotated the string appears at the rotated coordinate (i.e. 1,1). You could use trig, but my math skills are far worse than your English. I'd say the easy way would be to create a new Image object (Component.createImage()), do the rotate+write routine on its Graphics context, then paint the Image at x,y on your canvas.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic