开始新文件时我做错了什么

问题描述 投票:0回答:0

这是我尝试运行代码时遇到的错误。我从 Bro 代码中剪切和粘贴的这段代码关于 jframes 关于 guis 它不运行抛出这个错误

线程“主”java.lang.Error中的异常:未解决的编译问题:

at frame/frame.main.main(main.java:9) 

这是代码:

import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JFrame;


public class main {


     public static void main(String[] args) {

      // JFrame = a GUI window to add components to
      
      JFrame frame = new JFrame(); //creates a frame
      frame.setTitle("JFrame title goes here"); //sets title of frame
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //exit from application
      frame.setResizable(false); //prevent frame from being resized
      frame.setSize(420,420); //sets the x-dimension, and y-dimension of frame
      frame.setVisible(true); //make frame visible
      
      ImageIcon image = new ImageIcon("logo.png"); //create an ImageIcon
      frame.setIconImage(image.getImage()); //change icon of frame
      frame.getContentPane().setBackground(new Color(0x123456)); //change color of background
        
    
}

} 我知道我做错了什么但是。我猜我72岁的大脑想不出来

我找遍了试图找到答案,但找不到

import include
© www.soinside.com 2019 - 2024. All rights reserved.