Sunday, February 2, 2014

Graphics rotation in Swing








I've searched online and cannot find an answer. Do any of you know how to rotate a shape in Swing?







The only thing I found was something involving this, but I have not seen something like this before:












Java Code:











Graphics2D g2d = (Graphics2D)g;









I see this is an object reference, but what is on the right side? Does not seem like a method, as it would not equal a method nor would the parentheses be on the left. Why are parentheses there? Thanks



EDIT: Disregarding the above code, I would like to know how to rotate without Graphics 2d







Also, with G2D you it will not allow for setting x coords















No comments:

Post a Comment