Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java line

 
bala rajesh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i know how to draw a line.

but i don't know how to rotate a line in both x and y axies.

Thanks advance


Bala
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to java intermediate...
 
Adam Nace
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@bala rajesh:

could you be more specific? Are you drawing your lines using Graphics.drawLine, or Graphics2D.draw(Line2D)?

if you are using Graphics.drawLine, you will need to rotate your graphics object in the opposite direction, otherwise, you can create an Area from your Line2D, and rotate it, and draw the rotated Area.

Furthermore, how much do you want to rotate it by? Are you rotating by exact multiples of 90 degrees, or by some other angles? I also don't understand what you mean by rotating in the x or y axis. Rotation in 2D occurs about a point, not about a line. Rotation about a line occurs in 3D space.

Will you be rotating about the origin, or about some other point?


@Scott Selikoff

I don't mind answer this question here, but I'm not sure why you moved it here. I would think it should be moved to the Other Java API's forum, which indicates that it is the correct location of Java2D related threads.

- Adam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic