This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Change text orientation on canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Change text orientation on canvas" Watch "Change text orientation on canvas" New topic
Author

Change text orientation on canvas

Iason Dimitrakopoulos
Greenhorn

Joined: Nov 14, 2001
Posts: 13
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

Joined: Nov 14, 2001
Posts: 13
anyone?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8839
    
    7

Search this forum. This question has been asked at least 3 times in the past week.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Iason Dimitrakopoulos
Greenhorn

Joined: Nov 14, 2001
Posts: 13
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

Joined: Oct 29, 2001
Posts: 8839
    
    7

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change text orientation on canvas
 
Similar Threads
Window arrays
what is the swing of canvas ?
hi helpme
javascript canvas
I want to use canvas to read input from key pad!