| Author |
graphics problem!
|
Mateen Dar
Ranch Hand
Joined: Jan 14, 2005
Posts: 55
|
|
hi , i am facing triouble with a small grpahics problem. my project draws liens between various nodes. then a string is printed on these edges. the problem is g.drawString() writes the string completly horizontally. i want the string to be printed neatly next to the edge. u understand what i mean. how can i do this. i know the graphics 2d library has affine transformation, but i dont know how i can do it. thanks for u'r help the String ------------------------------
|
 |
Michael Ernest
High Plains Drifter
Sheriff
Joined: Oct 25, 2000
Posts: 7292
|
|
|
Really need to see some code on that in order to help.
|
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
|
 |
Mateen Dar
Ranch Hand
Joined: Jan 14, 2005
Posts: 55
|
|
Graphics2D g1= (Graphics2D)g; AffineTransform transform=new AffineTransform(); g1.drawLine(10,10,130,130); transform.rotate(Math.toRadians(45),77,77); g1.setTransform(transform); g1.drawString("Hello",75,75); this piece code does the trick .. but how do i undo the transform. cuase i have other strings to be printed at a different angle. thanks.
|
 |
Ryan McGuire
Ranch Hand
Joined: Feb 18, 2005
Posts: 945
|
|
Save the current transform before setting to the rotated one, and then set it back to the saved one.
|
 |
 |
|
|
subject: graphics problem!
|
|
|