Reputation: 11
I am attempting to recreate Wheel of Fortune in Java. What I have been thinking about doing is creating a wheel, and rotating the image and randomly stopping. But, I don't know how to rotate a JLabel. I am using NetBeans JFrame creator.
I can't really provide code, as this is just a concept in my head right now. I am planning to set the JLabel's icon to the wheel. I need to be able to rotate a JLabel at a button press, and stop at random. It then, needs to read the rotation value of the JLabel, so it can read the amount of points you win. Is this possible?
Yes, I have researched. All the other rotating JLabel forums do not show how to read the rotation value.
I am a beginner in Java. Any help is appreciated! :)
Upvotes: 0
Views: 284
Reputation: 324108
I am planning to set the JLabel's icon to the wheel. I need to be able to rotate a JLabel at a button press
Don't rotate the label, instead you can just rotate the Icon
.
Check out Rotated Icon. You just specify the angle of rotation and it will paint the Icon rotated. You can use the getDegrees()
method to know the current rotation at any time.
Upvotes: 1