java语言编程+数据库,编译出现下面的的情况:
求助各位高手,怎样去解决,学习不久,最好给我个完整的答案!!
如下:
--------------------配置: <默认>--------------------
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:302: 找不到符号
符号: 构造函数 UserLogin(MainWindow)
位置: 类 MainWindow.UserLogin
UserLogin UserLoginFrame=new UserLogin(this);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:414: 找不到符号
符号: 变量 TO_INSEART
位置: 类 MainWindow.yxsetFrame
yxsetFrame yxSet=new yxsetFrame(yxsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:414: 内部错误;无法将位于 MainWindow.yxsetFrame 的 MainWindow.yxsetFrame.<init> 实例化为 ()
yxsetFrame yxSet=new yxsetFrame(yxsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:458: 找不到符号
符号: 变量 TO_INSEART
位置: 类 MainWindow.zysetFrame
zysetFrame zySet=new zysetFrame(zysetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:458: 内部错误;无法将位于 MainWindow.zysetFrame 的 MainWindow.zysetFrame.<init> 实例化为 ()
zysetFrame zySet=new zysetFrame(zysetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:502: 找不到符号
符号: 变量 TO_INSEART
位置: 类 MainWindow.njsetFrame
njsetFrame njSet=new njsetFrame(njsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:502: 内部错误;无法将位于 MainWindow.njsetFrame 的 MainWindow.njsetFrame.<init> 实例化为 ()
njsetFrame njSet=new njsetFrame(njsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:546: 找不到符号
符号: 变量 TO_INSEART
位置: 类 MainWindow.bjsetFrame
bjsetFrame bjSet=new bjsetFrame(bjsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:546: 内部错误;无法将位于 MainWindow.bjsetFrame 的 MainWindow.bjsetFrame.<init> 实例化为 ()
bjsetFrame bjSet=new bjsetFrame(bjsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:590: 找不到符号
符号: 变量 TO_INSEART
位置: 类 MainWindow.xqsetFrame
xqsetFrame xqSet=new xqsetFrame(xqsetFrame.TO_INSEART);
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java:590: 内部错误;无法将位于 MainWindow.xqsetFrame 的 MainWindow.xqsetFrame.<init> 实例化为 ()
xqsetFrame xqSet=new xqsetFrame(xqsetFrame.TO_INSEART);
^
注意: C:\Documents and Settings\Administrator\桌面\新建文件夹\MainWindow.java 使用或覆盖了已过时的 API。
注意: 要了解详细信息,请使用 -Xlint:deprecation 重新编译。
11 错误
处理已完成。
源代码如下:
import java.io.* ;
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;
//**************************************************************************
class UserLogin extends JFrame
{
public void UserLogin()
{
}
}
class UserAdd extends JFrame{}
class UserModify extends JFrame{}
class UserDelete extends JFrame{}
class UserList extends JFrame{}
class yxsetFrame extends JFrame{}
class yxSelectFrame extends JFrame{}
class zysetFrame extends JFrame{}
class zySelectFrame extends JFrame{}
class njsetFrame extends JFrame{}
class njSelectFrame extends JFrame{}
class bjsetFrame extends JFrame{}
class bjSelectFrame extends JFrame{}
class xqsetFrame extends JFrame{}
class xqSelectFrame extends JFrame{}
//***********************************************************************
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(this);
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();
}
}
数据库如下:
package xjglxt;
import java.sql.*;
public class DataBaseManager
{
Connection con;
ResultSet rs;
Statement stmt;
public DataBaseManager()
{
try{
//DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
//con=DriverManager.getConnection("jdbc:oracle:thin:@happy:1521:myoracle","maimihui","maimihui");
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
con=DriverManager.getConnection("jdbc:odbc:ss","sa","1234");
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}
}
}
----------------解决方案--------------------------------------------------------
class UserAdd extends JFrame{}
class UserModify extends JFrame{}
class UserDelete extends JFrame{}
class UserList extends JFrame{}
class yxsetFrame extends JFrame{}
class yxSelectFrame extends JFrame{}
class zysetFrame extends JFrame{}
class zySelectFrame extends JFrame{}
class njsetFrame extends JFrame{}
class njSelectFrame extends JFrame{}
class bjsetFrame extends JFrame{}
class bjSelectFrame extends JFrame{}
class xqsetFrame extends JFrame{}
class xqSelectFrame extends JFrame{}
你这些类..都没有构造函数...而你实例化的时候..都带有构造函数.
----------------解决方案--------------------------------------------------------
那如果把它起掉了,还是有出现问题啊,没有了类啊.那怎么办啊?
给我个具体的回复啊 !!谢谢
----------------解决方案--------------------------------------------------------
不清楚.
不知道你为什么要这样搞...
class UserAdd extends JFrame{}
class UserModify extends JFrame{}
class UserDelete extends JFrame{}
class UserList extends JFrame{}
class yxsetFrame extends JFrame{}
class yxSelectFrame extends JFrame{}
class zysetFrame extends JFrame{}
class zySelectFrame extends JFrame{}
class njsetFrame extends JFrame{}
class njSelectFrame extends JFrame{}
class bjsetFrame extends JFrame{}
class bjSelectFrame extends JFrame{}
class xqsetFrame extends JFrame{}
class xqSelectFrame extends JFrame{}
----------------解决方案--------------------------------------------------------
可以添加构造函数啊 把set放进去可以不?
----------------解决方案--------------------------------------------------------
为什么我把实例化的时候..把都带有构造函数去了就可以.但是又有个问题呢,就是这样有对话框,但是又有一些用不了,为什么?可以QQ说吗?QQ:20987371,我的
----------------解决方案--------------------------------------------------------