idea 中setframewindow的问题

雨燕双飞 提交于 2020-03-10 16:31:33
在这里插入代码片
```package com.hfxt.view;

import com.hfxt.utils.P;

import javax.swing.*;

public class FrameWindow {
    public FrameWindow(){
        System.out.println("执行啦!");
        launch();
    }
    public void launch(){
        JFrame jFrame=new JFrame();
        jFrame.setTitle("飞机大战");
        jFrame.setSize(P.WIDTH,P.HEIGHT);
        jFrame.setLocationRelativeTo(null);
        jFrame.setDefaultCloseOperation(jFrame.EXIT_ON_CLOSE);
    }
}


package com.hfxt.run;

import com.hfxt.view.FrameWindow;

public class Main {
    public static void main(String[] args) {
        new FrameWindow();
    }
}



package com.hfxt.utils;

public class P {
    public static int WIDTH=800,HEIGHT=800;
}


![运行结果](https://img-blog.csdnimg.cn/20200310115619937.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2FuX3Vwd2FyZF9zbmFpbA==,size_16,color_FFFFFF,t_70)问,为什么显示不出来我所创建的窗口



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!