The moose likes Java in General and the fly likes java line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java line" Watch "java line" New topic

java line

bala rajesh

Joined: Jul 31, 2006
Posts: 6
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

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Moving to java intermediate...

[OCA 8 Book] [Blog]
Adam Nace
Ranch Hand

Joined: Jul 17, 2006
Posts: 117
@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
I agree. Here's the link:
subject: java line
It's not a secret anymore!