This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 9551
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: 9551
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!