开发者社区> 问答> 正文

java程序报错,求大神解答 ?报错

import java.awt.;
import javax.swing.
;
public class 窗口 extends JFrame{
package CreateJFrame
/**
* @param args
*/
public void CreateJFrame(String title){
JFrame jf=new JFrame(title);
Container container =jf.getContentPane();
JLabel jl=new JLabel("这是一个jframe窗体");
jl.setHorizontalAlignment(SwingConstants.CENTER);
container.add(jl);
container.setBackground(color.white);
jf.setVisible(true);
jf.setsize(200,150);
jf.setDefaultCloseOperation(WindowContents.EXIT_ON_CLOSE);

}
public static void main(String args[] ) {
    // TODO Auto-generated method stub
      new Exameple1().CreateJFrame("创建一个JFrame窗体");
}

}

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error, insert "enum Identifier" to complete EnumHeaderName
Syntax error, insert "EnumBody" to complete EnumDeclaration
Exameple1 cannot be resolved to a type
编写代码时报错,求大神解答一下

展开
收起
爱吃鱼的程序员 2020-06-23 13:53:11 539 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    Exameple1这是个类吧?我看你这里都没有定义或者引用。如果你是写在别的文件中,可以先引用这个类文件,这样才不会报错。不知道怎么引用的话,可以试试把光标放在Exameple1后面,然后同时按住alt+?这两个键

    2020-06-23 13:53:27
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载