Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Change text orientation on canvas  RSS feed

 
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?
 
Bartender
Posts: 9507
12
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
Posts: 9507
12
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
Boost this thread!