第一个GUI程序,在netbeans里因为没有自动导包,害的我差点崩溃,因为没有导入AWT包,所以

public class Jfram {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

EventQueue.invokeLater(()->{

SimpleFrame frame=new SimpleFrame();

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);}

);

}}

class SimpleFrame extends JFrame{

public SimpleFrame(){

setSize(300,200);

}

}

高亮的就是报错语句,上网查了,是为了线程安全,我现在也不太懂这个语法,先记上,

public class Jfram {

    /**

     * @param args the command line arguments

     */

    public static void main(String[] args) {

      

          SimpleFrame frame=new SimpleFrame();

          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

          frame.setVisible(true);}

     

          

      }

    

class SimpleFrame extends JFrame{

    public SimpleFrame(){

    setSize(300,200);

    }

}

事实证明,没有这段语法,程序也是能跑的,应该是为什么线程安全,巴拉巴拉的

书上设置像素大小,非要拿变量存着,setSize方法也是要在函数里调用,可能是因为要函数式编程吧,

问题还是在interlij idea里发现的,因为interlij里自动导包,学习了

最新文章

  1. div实现自适应高度的textarea,实现angular双向绑定
  2. what's cloud computing? IaaS
  3. 每天一个linux命令(14):head 命令
  4. struts2中的constant配置详解
  5. .net_ckeditor+ckfinder的图片上传配置
  6. C语言输出单个汉字字符
  7. C# ASPX.NET 文件(图片)下载
  8. C#学习笔记之线程 - 同步上下文
  9. Python:运算符
  10. html动态编辑框
  11. oracle 取头十条数据
  12. XCL-Charts圈图
  13. 使用c#给outlook添加任务、发送邮件
  14. YII 1.0 隐藏单入口index.php 设置路由与伪静态
  15. C++ Primer Plus阅读笔记
  16. Redux中间件组合方法
  17. vue-filter
  18. 如何用Win7远程链接ubuntu14.04桌面
  19. text_edit 未定义解决
  20. 数据库查询字段为null 时,返回0

热门文章

  1. C3861: “CoInitialize”“CoUninitialize”: 找不到标识符
  2. Power shell 读取电量,改变屏幕亮度
  3. Android中动态添加tab
  4. linux run/media/wang/centos_磁盘爆满
  5. flutter CustomScrollView多个滑动组件嵌套
  6. nextLine和hasNextLine的区别
  7. ubuntu下ntp时间同步
  8. 记录web面经
  9. C# List间的交集并集差集
  10. python33