Results 1 to 2 of 2
  1. #1
    Mira1000 is offline Member
    Join Date
    Nov 2011
    Rep Power

    Default rotate() method??

    Hello i have a problem rotating an image.

    when i compile this code it gives me the "Cannot find symbol error" at tells it can't find the rotate() method.

    i have seen the rotate() method beeing used several times around the internet, so i don't understand this error.

    So is there anyone who can tell why??

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    public class Xample extends JFrame{
    	public String txt="star.png";
    	public Image image;
    		ImageIcon imi = new ImageIcon(this.getClass().getResource(txt));
    		image = imi.getImage();
    public Image getImage(){
    	return image;
    public void paint(Graphics g){
    	Graphics g2d = (Graphics)g;
    public static void main(String[] s){
    	Xample app = new Xample();

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: rotate() method??

    The rotate() method is in the Graphics2D class. You've stored your Graphics2D as its parent class, Graphics, so you don't have access to that method. Fix your cast.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. How to rotate an image
    By ChipChamp in forum New To Java
    Replies: 4
    Last Post: 06-20-2012, 07:22 PM
  2. Replies: 2
    Last Post: 04-01-2010, 04:16 PM
  3. Image rotate
    By Micromani in forum AWT / Swing
    Replies: 0
    Last Post: 03-17-2010, 02:33 PM
  4. My rotate 2d pos method isnt working correctly..
    By Addez in forum New To Java
    Replies: 5
    Last Post: 12-01-2009, 10:04 AM
  5. Rotate Image!
    By Moncleared in forum AWT / Swing
    Replies: 1
    Last Post: 02-11-2009, 06:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts