当前位置: 代码迷 >> Java相关 >> 找不到符号
  详细解决方案

找不到符号

热度:283   发布时间:2007-01-03 00:06:54.0
找不到符号


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MainWindow extends JFrame implements ActionListener

{

JPanel panel1;

Container c;

JMenuBar MenuB;

JMenu SystemMenu,jiaoxueMenu,xuejiMenu,chengjiMenu,UserMGRMenu,yxMenu,

zyMenu,xqMenu,kcMenu,

njMenu,bjMenu;

JMenuItem UserLoginMenuItem,UserAddMenuItem,UserModifyMenuItem,

UserDeleteMenuItem,UserListMenuItem,ExitMenuItem,

yxsetMenuItem,yxselectMenuItem,zysetMenuItem,zyselectMenuItem,

njsetMenuItem,njselectMenuItem,bjsetMenuItem,bjselectMenuItem,

xqsetMenuItem,xqselectMenuItem,kcsetMenuItem,kcselectMenuItem,

BorrowBookMenuItem,BorrowInfoMenuItem,ReturnBookMenuItem,

ReturnInfoMenuItem,

BookListMenuItem,BorrowBookListMenuItem;

JLabel titleLabel,AuthorLabel,DateLabel;

public MainWindow()

{

super("学生信息管理系统");

//--系统管理菜单--

MenuB=new JMenuBar();

SystemMenu=new JMenu("系统管理");

UserMGRMenu=new JMenu("用户管理");

UserLoginMenuItem=new JMenuItem("用户登录");

UserAddMenuItem=new JMenuItem("添加用户");

UserModifyMenuItem=new JMenuItem("修改用户");

UserDeleteMenuItem=new JMenuItem("删除用户");

UserListMenuItem=new JMenuItem("用户列表");

ExitMenuItem=new JMenuItem("退出");

SystemMenu.add(UserLoginMenuItem);

UserMGRMenu.add(UserAddMenuItem);

UserMGRMenu.add(UserModifyMenuItem);

UserMGRMenu.add(UserDeleteMenuItem);

UserMGRMenu.add(UserListMenuItem);

SystemMenu.add(UserMGRMenu);

SystemMenu.add(ExitMenuItem);

UserLoginMenuItem.addActionListener(this);

UserAddMenuItem.addActionListener(this);

UserModifyMenuItem.addActionListener(this);

UserDeleteMenuItem.addActionListener(this);

UserListMenuItem.addActionListener(this);

ExitMenuItem.addActionListener(this);

MenuB.add(SystemMenu);

//---院系管理菜单--

jiaoxueMenu=new JMenu("教学管理");

yxMenu=new JMenu("院系管理");

zyMenu=new JMenu("专业管理");

njMenu=new JMenu("年级管理");

bjMenu=new JMenu("班级管理");

xqMenu=new JMenu("学期管理");

kcMenu=new JMenu("课程管理");

jiaoxueMenu.add(yxMenu);

jiaoxueMenu.add(zyMenu);

jiaoxueMenu.add(njMenu);

jiaoxueMenu.add(bjMenu);

jiaoxueMenu.add(xqMenu);

jiaoxueMenu.add(kcMenu);

yxsetMenuItem=new JMenuItem("院系设置");

yxselectMenuItem=new JMenuItem("院系查询");

zysetMenuItem=new JMenuItem("专业设置");

zyselectMenuItem=new JMenuItem("专业查询");

njsetMenuItem=new JMenuItem("年级设置");

njselectMenuItem=new JMenuItem("年级查询");

bjsetMenuItem=new JMenuItem("班级设置");

bjselectMenuItem=new JMenuItem("班级查询");

xqsetMenuItem=new JMenuItem("学期设置");

xqselectMenuItem=new JMenuItem("学期查询");

kcsetMenuItem=new JMenuItem("课程设置");

kcselectMenuItem=new JMenuItem("课程查询");

yxMenu.add(yxsetMenuItem);

yxMenu.add(yxselectMenuItem);

zyMenu.add(zysetMenuItem);

zyMenu.add(zyselectMenuItem);

njMenu.add(njsetMenuItem);

njMenu.add(njselectMenuItem);

bjMenu.add(bjsetMenuItem);

bjMenu.add(bjselectMenuItem);

xqMenu.add(xqsetMenuItem);

xqMenu.add(xqselectMenuItem);

kcMenu.add(kcsetMenuItem);

kcMenu.add(kcselectMenuItem);

yxsetMenuItem.addActionListener(this);

yxselectMenuItem.addActionListener(this);

zysetMenuItem.addActionListener(this);

zyselectMenuItem.addActionListener(this);

njsetMenuItem.addActionListener(this);

njselectMenuItem.addActionListener(this);

bjsetMenuItem.addActionListener(this);

bjselectMenuItem.addActionListener(this);

xqsetMenuItem.addActionListener(this);

xqselectMenuItem.addActionListener(this);

kcsetMenuItem.addActionListener(this);

kcselectMenuItem.addActionListener(this);

MenuB.add(jiaoxueMenu);

xuejiMenu=new JMenu("学籍管理");

BorrowBookMenuItem=new JMenuItem("学生增减");

BorrowInfoMenuItem=new JMenuItem("批量导入");

xuejiMenu.add(BorrowBookMenuItem);

xuejiMenu.add(BorrowInfoMenuItem);

BorrowBookMenuItem.addActionListener(this);

BorrowInfoMenuItem.addActionListener(this);

MenuB.add(xuejiMenu);

chengjiMenu=new JMenu("成绩管理");

ReturnBookMenuItem=new JMenuItem("学生选课");

ReturnInfoMenuItem=new JMenuItem("学生成绩");

chengjiMenu.add(ReturnBookMenuItem);

chengjiMenu.add(ReturnInfoMenuItem);

ReturnBookMenuItem.addActionListener(this);

ReturnInfoMenuItem.addActionListener(this);

MenuB.add(chengjiMenu);

setJMenuBar(MenuB);

titleLabel=new JLabel(new ImageIcon(".\\pic.jpg"));

c=getContentPane();

c.setLayout(new BorderLayout());

panel1=new JPanel();

panel1.setLayout(new BorderLayout());

panel1.add(titleLabel,BorderLayout.CENTER);

c.add(panel1,BorderLayout.CENTER);

setBounds(100,50,400,300);

show();

UserMGRMenu.setEnabled(false);

jiaoxueMenu.setEnabled(false);

xuejiMenu.setEnabled(false);

chengjiMenu.setEnabled(false);

}



//////////////////////////////////////////////////////////////////////////////////////
public void actionPerformed(ActionEvent e)

{

//--系统管理菜单--

if(e.getActionCommand()=="用户登录")

{

UserLogin UserLoginFrame=new UserLogin();

Dimension FrameSize=UserLoginFrame.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

UserLoginFrame.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

UserLoginFrame.pack();

UserLoginFrame.show();

}

else if(e.getActionCommand()=="添加用户")

{

UserAdd UserAddFrame=new UserAdd();

Dimension FrameSize=UserAddFrame.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

UserAddFrame.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

UserAddFrame.pack();

UserAddFrame.show();

}

else if(e.getActionCommand()=="修改用户")

{

UserModify UserModifyFrame=new UserModify();

Dimension FrameSize=UserModifyFrame.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

UserModifyFrame.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

UserModifyFrame.pack();

UserModifyFrame.show();

}

else if(e.getActionCommand()=="删除用户")

{

UserDelete UserDeleteFrame=new UserDelete();

Dimension FrameSize=UserDeleteFrame.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

UserDeleteFrame.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

UserDeleteFrame.pack();

UserDeleteFrame.show();

}

else if(e.getActionCommand()=="用户列表")

{

UserList UserListFrame=new UserList();

Dimension FrameSize=UserListFrame.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

UserListFrame.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

UserListFrame.pack();

UserListFrame.show();

}

//--教学管理菜单--

else if(e.getActionCommand()=="院系设置")

{

yxsetFrame yxSet=new yxsetFrame(yxsetFrame.TO_INSEART);

Dimension FrameSize=yxSet.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

yxSet.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

yxSet.pack();

yxSet.show();

}

else if(e.getActionCommand()=="院系查询")

{

yxSelectFrame yxSelect=new yxSelectFrame();

Dimension FrameSize=yxSelect.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

yxSelect.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

yxSelect.pack();

yxSelect.show();

}

else if(e.getActionCommand()=="专业设置")

{

zysetFrame zySet=new zysetFrame(zysetFrame.TO_INSEART);

Dimension FrameSize=zySet.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

zySet.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

zySet.pack();

zySet.show();

}

else if(e.getActionCommand()=="专业查询")

{

zySelectFrame zySelect=new zySelectFrame();

Dimension FrameSize=zySelect.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

zySelect.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

zySelect.pack();

zySelect.show();

}

else if(e.getActionCommand()=="年级设置")

{

njsetFrame njSet=new njsetFrame(njsetFrame.TO_INSEART);

Dimension FrameSize=njSet.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

njSet.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

njSet.pack();

njSet.show();

}

else if(e.getActionCommand()=="年级查询")

{

njSelectFrame njSelect=new njSelectFrame();

Dimension FrameSize=njSelect.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

njSelect.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

njSelect.pack();

njSelect.show();

}

else if(e.getActionCommand()=="班级设置")

{

bjsetFrame bjSet=new bjsetFrame(bjsetFrame.TO_INSEART);

Dimension FrameSize=bjSet.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

bjSet.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

bjSet.pack();

bjSet.show();

}

else if(e.getActionCommand()=="班级查询")

{

bjSelectFrame bjSelect=new bjSelectFrame();

Dimension FrameSize=bjSelect.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

bjSelect.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

bjSelect.pack();

bjSelect.show();

}

else if(e.getActionCommand()=="学期设置")

{

xqsetFrame xqSet=new xqsetFrame(xqsetFrame.TO_INSEART);

Dimension FrameSize=xqSet.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

xqSet.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

xqSet.pack();

xqSet.show();

}

else if(e.getActionCommand()=="学期查询")

{

xqSelectFrame xqSelect=new xqSelectFrame();

Dimension FrameSize=xqSelect.getPreferredSize();

Dimension MainFrameSize=getSize();

Point loc=getLocation();

xqSelect.setLocation((MainFrameSize.width-FrameSize.width)/2+loc.x,

(MainFrameSize.height-FrameSize.height)/2+loc.y);

xqSelect.pack();

xqSelect.show();

}
}
/////////////////////////////////////////////////////////////////////////////
//--设置登录用户的权限--

public void setEnable(String powerType)

{

if(powerType.trim().equals("系统管理员"))

{

UserMGRMenu.setEnabled(true);

jiaoxueMenu.setEnabled(true);

xuejiMenu.setEnabled(true);

chengjiMenu.setEnabled(true);

UserListMenuItem.setEnabled(true);

}

else if(powerType.trim().equals("else"))

{

UserMGRMenu.setEnabled(false);

jiaoxueMenu.setEnabled(false);

xuejiMenu.setEnabled(false);

chengjiMenu.setEnabled(false);

}

}

public static void main(String args[])

{

MainWindow mainFrame=new MainWindow();

}
}



C:\Documents and Settings\Administrator\桌面\MainWindow.java:279: 找不到符号
符号: 类 UserLogin
位置: 类 MainWindow
UserLogin UserLoginFrame=new UserLogin();
^
C:\Documents and Settings\Administrator\桌面\MainWindow.java:279: 找不到符号
符号: 类 UserLogin
位置: 类 MainWindow
UserLogin UserLoginFrame=new UserLogin();
^
C:\Documents and Settings\Administrator\桌面\MainWindow.java:301: 找不到符号
符号: 类 UserAdd
位置: 类 MainWindow
UserAdd UserAddFrame=new UserAdd();
^

搜索更多相关的解决方案: 符号  import  awt  java  Container  

----------------解决方案--------------------------------------------------------
没有UserLogin、UserAdd这两个类
----------------解决方案--------------------------------------------------------
编译器已经告诉你很详细了,并且还是用中文告诉你的
----------------解决方案--------------------------------------------------------
这种错误一般都是变量,类名称出错!!
----------------解决方案--------------------------------------------------------

好了,的确是没有类
谢谢


----------------解决方案--------------------------------------------------------
  相关解决方案