0

enter image description hereHere is my GamePanel Classand the CanvasSorry if this is an irritatingly simple problem, but I'm a newbie to the Java language and I can't see where I'm going wrong with this. I get an error with my code when trying to define new GamePanel "cannot find symbol - class GamePanel".

package chickengame;

import javax.swing.*;
/**
 *
 * @author ec
 */
public class ChickenGame {

    /**
     * @param args the command line arguments
     */
     public static void main(String[] args) {
        
        SwingUtilities.invokeLater(new Runnable() {
        
            
            public void run() {
                    JFrame gameFrame = new JFrame("Flying Chicken Game");
                    gameFrame.add(new GamePanel());
                    gameFrame.pack();
                    gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    //gameFrame.setSize(500,600);
                    gameFrame.setLocationRelativeTo(null);
                            
                    gameFrame.setVisible(true);
            }
        });
        
    }
    
}
  • 1
    Where is `GamePanel` defined? What library is `GamePanel` from? – Jim Garrison May 03 '21 at 22:43
  • Yep that's a newbie question :-) Read through the standard tutorial on use of packages so you can understand how to use `GamePanel`. See https://docs.oracle.com/javase/tutorial/java/package/usepkgs.html – sprinter May 03 '21 at 22:52

0 Answers0