Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't rotate ellipse

 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read about it here:
http://download.oracle.com/javase/tutorial/2d/advanced/transforming.html
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

That's some pretty cool stuff!
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already read that article ,thatś why posted the question here !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic