When I hover over JFrame to import, it comes up with the message:
"Access restriction: The constructor JFrame(String) is not accessible due to restriction on required library C:\Program Files (x86)\Java\jre1.8.0_31\lib\rt.jar"
Also, my frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
line isn't working, either. It comes up with the same thing. Anyone have any idea how to fix this?
package com.tutorial.main;
import java.awt.Canvas;
import java.awt.Frame;
import javax.swing.*;
import java.awt.Dimension;
public class Window extends Canvas{
private static final long serialVersionUID = -240840600533728354L;
public Window(int width, int height, String title){
JFrame frame = new JFrame(title);
frame.setPreferredSize(new Dimension(width,height));
frame.setMinimumSize(new Dimension(width,height));
frame.setMaximumSize(new Dimension(width,height));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.add(game);
frame.setVisible(true);
Game.start();
}
}