| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2500 人关注过本帖
标题:关于“cannot be resolved to a type”的问题
只看楼主 加入收藏
程序小怪
Rank: 1
等 级:新手上路
帖 子:13
专家分:3
注 册:2017-3-3
结帖率:66.67%
收藏
 问题点数:0 回复次数:1 
关于“cannot be resolved to a type”的问题
import javax.swing.*;
import javax.awt.event.*;
import javax.awt.*;

public class Test02 extends JFrame {
   
    //窗口的创建方法
    public void CreateFrame(){
        JPanel jp1=new JPanel();
        JPanel jp2=new JPanel();
        JPanel jp3=new JPanel();
        
        JLabel jl1=new JLabel("用户名:");
        JLabel jl2=new JLabel("密码:");
        
        JButton jb1=new JButton("登录");
        JButton jb2=new JButton("重置");
        
        JTextField jtf=new JTextField(10);
        JPasswordField jpf=new JPasswordField(10);
        
        this.setLayout(new GridLayout(3,1));
        
        jp1.add(jl1);
        jp1.add(jtf);
        jp2.add(jl2);
        jp2.add(jpf);
        jp3.add(jb1);
        jp3.add(jb2);
        this.add(jp1);
        this.add(jp2);
        this.add(jp3);
        

        this.setTitle("示例窗口");
        //this.pack();
        this.setSize(800,600);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
   
    public static void main(String[] args){
        Test02 frame1=new Test02();
        frame1.CreateFrame();
    }

}
为什么会提示错误Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    GridLayout cannot be resolved to a type
搜索更多相关主题的帖子: cannot type new this add 
2017-09-16 09:15
程序小怪
Rank: 1
等 级:新手上路
帖 子:13
专家分:3
注 册:2017-3-3
收藏
得分:0 
原来是包导错了
2017-09-16 09:51
快速回复:关于“cannot be resolved to a type”的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015036 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved