JAVA画弹框

是星星哇! / 2023-08-11 / 原文

package cn.dbd;
import javax.swing.JPanel;//1.
import  javax.swing.JFrame;
//游戏窗口
public class World extends JPanel { //2.
    public static void main(String[] args) {
        JFrame frame = new JFrame();//3.
        World world = new World(); //分配窗口中的那一堆对象
        world.setFocusable(true);
        frame.add(world);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(641+16,479+39);//window10
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        }}