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

Rotating an ImageIcon

 
Keshan Pillay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone! Thank you for taking the time to look at my thread.
I have an assignment to do on concurrency. That's fine, however I face an initial hurdle.

This assignment is based on the dining philosophers problem.
I can change the number of philosophers at present by changing the appropriate variable in the code. I'm supposed to rotate the
philosophers around the table so they all "face" the centre, but at present they all remain upright around the table.

The rotateImageIcon method is the one I need to implement. It is stated in the handout that it is called in the correct places, and that we just need to implement it. Initially it is empty, except for the return statement "return picture".
What is currently within the method is my attempt.

We were given a URL as a hint.
This is the URL

However I can't seem to make any headway =[ I would appreciate it if someone could please push me in the right direction =]

Here is my code, and thanks again =D









Cheers!
 
Rob Camick
Ranch Hand
Posts: 2564
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, your code doesn't look like the code from the example.

Did you download the example and text it? Was the image rotated? Why did you change the code?
 
Keshan Pillay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply. Actually, all the code I presented was given to us as a skeleton for the assignment. The everything was given, and certain
parts are missing.

// FOR YOU... (these are parts we need to complete)


rotateImageIcon is the method I had a go at completing. It hasn't seemed to worked.
 
Keshan Pillay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh! I got it! I changed "at.rotate(Math.toRadians(angle), w/2.0, h/2.0); " to

at.rotate(angle, w/2.0, h/2.0);

now it works!

only there are these vertical black boxes shadowing the original position of the icons =p
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic