Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing Text with an angle(45 degree).

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I hope someone will help me with this,I'm trying to write a text
not vertical or horizontal,just with a certain angle(say 45 degree).
Thanks alot.
 
Swapan Golla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can change transformations and tilt the co ordinate axis.
Eg.
//Always get a reference to old transformation for restoring
//back the previous one
AffineTransform oldTransform = g.getTransform();
AffineTransform ct = AffineTransform.getTranslateInstance(x,y);
g.transform(ct);
g.transform(AffineTransform.getRotateInstance(Math.PI *(1.5) ));

Hope this eg. code helps.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
The problem with Graphics2D class is my browser doesn't support its methods.
For that i coyuldn't fix in this way,also if i use plugin i got problem with other stuff in my program when i pass parameters from java to javascript .
what i need is very simple code to do the transformation or rotation of my characters.
I hope you will find away to fix it.
Thanks alot for your help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic