1、JAVA学生管理系统 JAVA学生管理系统编译提示(1)有使用其他可视化Java编程工具经验的用户也可以利用这些软件已经携带的JDK。例如从“控制面板”中通过【系统】|【高级】|【环境变量】,针对JBuilder8设置环境变量,即把Path路径设置为C:JBuilder8jdk1.4bin,然后将每章“源程序”目录之中的内容保存在例如C:temp目录中,然后即可在命令提示符窗口中切换到C:temp并使用javac classpath . *.java命令进行编译(其中-classpath用来告诉编译器用户Java文件的路径,“ . ”表示*.java文件的路径在当前目录位置,注意点的前后均有一
2、个空格)。经过编译产生*.class文件后,在C:temp提示符下使用java classpath . * 命令即可运行程序(其中-classpath用来告诉编译器用户类文件的路径,“ . ”表示*.class文件的路径在当前目录位置,注意点的前后均有一个空格。“*”为不包括扩展名的类文件名)。(2)上述方法对于直接安装的JDK 1.5亦完全适用。(3)也可以象书中介绍的那样,在使用javac命令之前使用set classpath=c:temp设置类路径(等号前后不能有空格),然后即可直接使用javac *.java编译命令和java *运行命令。(4)但是应注意,在使用JDK 1.4时,个别
3、程序可能会无法正常编译运行(因JDK 1.5的编程方式略有变化)。所以应首选JDK 1.5。(5)与在“环境变量”对话框中设置类路径相比,在命令提示符窗口中设置类路径是比较稳妥的方法。因为用户存放程序代码的目录位置是根据内容不同而随时确定的。此外您可能会发现“环境变量”对话框中的ClassPath设置在有些情况下毫无作用。AddCourseInfo.javaimport java.awt.event.*;import java.awt.*;import javax.swing.*;/* 课程信息管理模块* 添加新的课程信息*/public class AddCourseInfo extends
4、 CourseInfoCrsBean getCnum = new CrsBean();public AddCourseInfo() this.setTitle(添加课程信息);this.setResizable(false);cNum.setEditable(false);cNum.setText(+getCnum.getCrsId();cName.setEditable(true);cTeacher.setEditable(true);cType.setEditable(true);cTime.setEditable(true);cPlace.setEditable(true);/设置运行位
5、置,使对话框居中Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation( (int) (screenSize.width - 400) / 2 ,(int) (screenSize.height - 300) / 2 +45);public void downInit()addInfo.setText(增加);addInfo.setFont(new Font(Dialog,0,12);downPanel.add(addInfo);clearInfo.setText(清空);clear
6、Info.setFont(new Font(Dialog,0,12);downPanel.add(clearInfo);eixtInfo.setText(退出);eixtInfo.setFont(new Font(Dialog,0,12); * 事件处理 */public void actionPerformed(ActionEvent e) Object obj = e.getSource();if (obj = eixtInfo) /退出this.dispose();else if (obj = addInfo) /增加cNum.setEnabled(false);cName.setEdi
7、table(false);cTeacher.setEditable(false);cType.setEditable(false);cTime.setEditable(false);cPlace.setEditable(false);/PaddInfo.setEnabled(false); clearInfo.setEnabled(false); eixtInfo.setEnabled(false);CrsBean addCrs = new CrsBean();addCrs.crsAdd(cName.getText(), cTeacher.getText(), cPlace.getText()
8、, cType.getText(), cTime.getText();this.dispose();AddCourseInfo aci = new AddCourseInfo();aci.downInit();aci.pack();aci.setVisible(true);this.dispose();else if (obj = clearInfo) /清空setNull();cNum.setText(+getCnum.getCrsId();543 JAVA学生管理系统AddGradeInfo.javaimport java.awt.event.*;import java.awt.*;imp
9、ort javax.swing.*; /* 成绩信息管理模块* 添加新的成绩信息*/public class AddGradeInfo extends GradeInfo implements ActionListenerpublic AddGradeInfo() this.setTitle(添加成绩信息);this.setResizable(false);/设置运行位置,使对话框居中Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation( (int) (screenSize.wid
10、th - 400) / 2 ,(int) (screenSize.height - 300) / 2 +45);public void downInit()addInfo.setText(增加);addInfo.setFont(new Font(Dialog,0,12);downPanel.add(addInfo);eixtInfo.setText(退出);eixtInfo.setFont(new Font(Dialog,0,12);downPanel.add(eixtInfo);this.contentPane.add(downPanel,BorderLayout.SOUTH);sNum.a
11、ddActionListener(this);addInfo.addActionListener(this);eixtInfo.addActionListener(this);/* * 事件处理 */public void actionPerformed(ActionEvent e) Object obj = e.getSource();if (obj = addInfo) /增加cNum.setEnabled(false);cName.setEditable(false);cTeacher.setEditable(false);Grade.setEditable(false);sNum.se
12、tEditable(false);sName.setEditable(false);/P 口的位置Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();this.setLocation(screenSize.width - 400) / 2, (screenSize.height - 300) / 2 + 45); public void downInit()addInfo.setText(增加);addInfo.setFont(new Font(Dialog,0,12);downPanel.add(addInfo
13、);clearInfo.setText(清空);clearInfo.setFont(new Font(Dialog,0,12);downPanel.add(clearInfo);eixtInfo.setText(退出);eixtInfo.setFont(new Font(Dialog,0,12);downPanel.add(eixtInfo);/添加事件侦听/* * 事件处理 */public void actionPerformed(ActionEvent e) Object obj = e.getSource();if (obj = eixtInfo) /退出this.dispose();
14、else if (obj = addInfo) /增加sNum.setEnabled(false);sName.setEnabled(false);sSex.setEnabled(false);sSethnic.setEnabled(false);sBirth.setEnabled(false);sYear.setEnabled(false);sMajor.setEnabled(false);sCollege.setEnabled(false);sHome.setEnabled(false);addInfo.setEnabled(false);clearInfo.setEnabled(fals
15、e);eixtInfo.setEnabled(false);StuBean addStu = new StuBean();addStu.stuAdd(sName.getText(), sSex.getText(), sBirth.getText(), sHome.getText(), sSethnic.getText(), sYear.getText(), sMajor.getText(), sCollege.getText();this.dispose();AddStuInfo asi = new AddStuInfo();asi.downInit();asi.pack();asi.setV
16、isible(true);else if (obj = clearInfo) /清空setNull();sNum.setText(+getSnum.getStuId(); JAVA学生管理系统import javax.swing.*;import java.awt.*;import java.awt.event.*;import .*; /* 课程信息综合管理类* 提供主界面,供其他类继承*/public class CourseInfo extends JFrame implements ActionListenerContainer contentPane;JPanel centerPan
17、el = new JPanel();JPanel upPanel = new JPanel();JPanel downPanel = new JPanel();/框架的大小Dimension faceSize = new Dimension(800, 500);JLabel jLabel1 = new JLabel();JLabel jLabel2 = new JLabel();JLabel jLabel3 = new JLabel();JLabel jLabel4 = new JLabel();JLabel jLabel5 = new JLabel();JLabel jLabel6 = ne
18、w JLabel();JTextField cNum = new JTextField(15);JTextField cName = new JTextField(15);JTextField cTeacher = new JTextField(15);JTextField cType = new JTextField(15);JTextField cTime = new JTextField(15);JTextField cPlace = new JTextField(15);JButton searchInfo = new JButton();JButton addInfo = new J
19、Button();JButton modifyInfo = new JButton();JButton deleteInfo = new JButton();JButton clearInfo = new JButton();JButton saveInfo = new JButton();JButton eixtInfo = new JButton();GridBagLayout girdBag = new GridBagLayout();GridBagConstraints girdBagCon;public CourseInfo() this.setSize(faceSize);/设置标
20、题this.setTitle(课程综合信息管理); this.setResizable(false);/设置程序图标this.setIconImage(getImage(icon.gif);tryInit();catch(Exceptione) e.printStackTrace();public void Init() throws Exception contentPane = this.getContentPane();contentPane.setLayout(new BorderLayout();/中部面板的布局centerPanel.setLayout(girdBag);jLabe
21、l1.setText(课程编码:);jLabel1.setFont(new Font(Dialog,0,12);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 0;girdBagCon.gridy = 0;girdBagCon.insets = new Insets(10,10,10,1);girdBag.setConstraints(jLabel1,girdBagCon);centerPanel.add(jLabel1); girdBagCon = new GridBagConstraints();girdBagCon.gri
22、dx = 1;girdBagCon.gridy = 0;girdBagCon.insets = new Insets(10,1,10,15);girdBag.setConstraints(cNum,girdBagCon);centerPanel.add(cNum);jLabel2.setText(课程名称:);jLabel2.setFont(new Font(Dialog,0,12);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 2;girdBagCon.gridy = 0;girdBagCon.insets = new In
23、sets(10,15,10,1);girdBag.setConstraints(jLabel2,girdBagCon);centerPanel.add(jLabel2);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 3;girdBagCon.gridy = 0;girdBagCon.insets = new Insets(10,1,10,10);girdBag.setConstraints(cName,girdBagCon);centerPanel.add(cName);jLabel3.setText(授课老师:);jLabe
24、l3.setFont(new Font(Dialog,0,12);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 0;girdBagCon.gridy = 1;girdBagCon.insets = new Insets(10,10,10,1);girdBag.setConstraints(jLabel3,girdBagCon);centerPanel.add(jLabel3);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 1;girdBagCon.gridy
25、= 1;girdBagCon.insets = new Insets(10,1,10,15);girdBag.setConstraints(cTeacher,girdBagCon);centerPanel.add(cTeacher);jLabel4.setText(课程类别:);jLabel4.setFont(new Font(Dialog,0,12);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 2;girdBagCon.gridy = 1;girdBagCon.insets = new Insets(10,15,10,1)
26、;girdBag.setConstraints(jLabel4,girdBagCon);centerPanel.add(jLabel4);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 3;girdBagCon.gridy = 1;girdBagCon.insets = new Insets(10,1,10,10);girdBag.setConstraints(cType,girdBagCon);centerPanel.add(cType);jLabel5.setText(上课时间:);jLabel5.setFont(new F
27、ont(Dialog,0,12);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 0;girdBagCon.gridy = 2;girdBagCon.insets = new Insets(10,10,10,1);girdBag.setConstraints(jLabel5,girdBagCon);centerPanel.add(jLabel5);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 1;girdBagCon.gridy = 2;girdBagCon.i
28、nsets = new Insets(10,1,10,15);girdBag.setConstraints(cTime,girdBagCon);centerPanel.add(cTime);jLabel6.setText(上课地点:);jLabel6.setFont(new Font(Dialog,0,12);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 2;girdBagCon.gridy = 2;girdBagCon.insets = new Insets(10,15,10,1);girdBag.setConstraints(jLabel6,girdBagCon);centerPanel.add(jLabel6);girdBagCon = new GridBagConstraints();girdBagCon.gridx = 3;girdBagCon.insets = new Insets(10,1,10,10);girdBag.setConstraints(cPlace,girdBagCon);centerPanel.add(cPla
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1