Why my import javax.swing.Jpanel show as error "Jpanel cannot be resolved to a type"?

Viewed 46

I am trying to follow "How to Make a 2D Game in Java #1 - The Mechanism of 2D Games" on youtube and not even 10 minutes in I have an error with my import javax.swing.JPanel;in the main function and this import says it cannot be resolved to a type. I already looked up a bunch of videos and they said to go into the library and change to 'JRE 1.7' yet when I did that the error stayed. I am new to coding and java and just wanted to try this project so please explain in an easy to follow way thank you!

package main;

import java.awt.Dimension;

import javax.swing.JPanel; (Error message is here)

public class GamePanel extends JPanel { (Error message here)
    
    final int originalTileSize = 16; // 16x16 tile
    final int scale = 3;
    final int tileSize = originalTileSize * scale; //48x48 tiles
    final int maxScreenCol = 16;
    final int maxScreenRow = 12;
    final int screenWidth = tileSize * maxScreenCol; //760 pixles
    final int screenHeight = tileSize * maxScreenRow; // 576 pixles
}
0 Answers
Related