| Author |
can't rotate ellipse
|
budsy remo
Ranch Hand
Joined: Sep 20, 2008
Posts: 103
|
|
hi i'm working on a simple code , but i am not able to rotate it correctly
please help .
I am using the Ellipse2D class with AffineTransform
|
 |
john price
Ranch Hand
Joined: Feb 24, 2011
Posts: 495
|
|
e1=new Ellipse2D.Double(100,150,200,70);
Change to:
1. At the top of code:
2. Later in your code at paintComponent:
If you would like a real, working example I would be more than happy to accompany that request.
Good luck,
cc11rocks, aka John Price
EDIT: Then later in your code, set the things you need changed. For example, if you want e1 moved down, you just say:
Or whatever. Hopefully, I am clear and make sense. If not, I can give you a real life example.
|
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
|
 |
budsy remo
Ranch Hand
Joined: Sep 20, 2008
Posts: 103
|
|
|
Thanks for the reply but i really want to use the affinetransform in order to rotate that ellipse . I did think about the same thing while making the code . By changing the y coordinate of the ellipse would greatly make this code dependent for only this Shape . Actually what i am really trying to do is make a very simple tetris game out of it and by using AffineTransform i'll be able to make the different shapes( i'll be using more) coordinate independent .
|
 |
john price
Ranch Hand
Joined: Feb 24, 2011
Posts: 495
|
|
The
was just an example.
I think it would probably help you if you used the technique I suggested. I don't know about the affinetransform method, but if you use variables instead of "fixed" values, you might save yourself from future problems, some of which MAY OR MAY NOT arise from using affinetransform and "fixed" values. Anyway, good luck!
cc11rocks aka John Price
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
Read about it here:
http://download.oracle.com/javase/tutorial/2d/advanced/transforming.html
|
luck, db
There are no new questions, but there may be new answers.
|
 |
john price
Ranch Hand
Joined: Feb 24, 2011
Posts: 495
|
|
That's some pretty cool stuff!
|
 |
budsy remo
Ranch Hand
Joined: Sep 20, 2008
Posts: 103
|
|
|
I have already read that article ,thatś why posted the question here !!
|
 |
 |
|
|
subject: can't rotate ellipse
|
|
|