Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Drawing Vertical Strings in a Java Applet

 
Tim Collins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am writing a java applet that displays a line graph, and I am wondering if it is possible to draw vertical strings in the applet. the drawString method only allows you to give it a startX and a startY, which means that the only way to draw that string is horizontal.
If you know how to do this, I would appreciate any information you could provide.
Thanks.
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a loop control, you can use charAt(String toDraw) to draw each character of the string with a constant X-coordinate and decreamental Y-coordinate.
You need to experiment to find correct X-coordinate and correct y-coordinate and its decreamental according to the font you are using for the string.
Hope this helps.
Ruilin
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!