JAVA学生管理系统.docx

上传人:b****3 文档编号:5421725 上传时间:2022-12-16 格式:DOCX 页数:22 大小:20.96KB
下载 相关 举报
JAVA学生管理系统.docx_第1页
第1页 / 共22页
JAVA学生管理系统.docx_第2页
第2页 / 共22页
JAVA学生管理系统.docx_第3页
第3页 / 共22页
JAVA学生管理系统.docx_第4页
第4页 / 共22页
JAVA学生管理系统.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

JAVA学生管理系统.docx

《JAVA学生管理系统.docx》由会员分享,可在线阅读,更多相关《JAVA学生管理系统.docx(22页珍藏版)》请在冰豆网上搜索。

JAVA学生管理系统.docx

JAVA学生管理系统

∙JAVA学生管理系统

编译提示

(1) 有使用其他可视化Java编程工具经验的用户也可以利用这些软件已经携带的JDK。

例如从“控制面板”中通过【系统】|【高级】|【环境变量】,针对JBuilder8设置环境变量,即把Path路径设置为C:

\JBuilder8\jdk1.4\bin,然后将每章“源程序”目录之中的内容保存在例如C:

\temp目录中,然后即可在命令提示符窗口中切换到C:

\temp>并使用javac–classpath.*.java命令进行编译(其中-classpath用来告诉编译器用户Java文件的路径,“.”表示*.java文件的路径在当前目录位置,注意点的前后均有一个空格)。

经过编译产生*.class文件后,在C:

\temp>提示符下使用java–classpath.*命令即可运行程序(其中-classpath用来告诉编译器用户类文件的路径,“.”表示*.class文件的路径在当前目录位置,注意点的前后均有一个空格。

“*”为不包括扩展名的类文件名)。

(2) 上述方法对于直接安装的JDK1.5亦完全适用。

(3) 也可以象书中介绍的那样,在使用javac命令之前使用setclasspath=c:

\temp设置类路径(等号前后不能有空格),然后即可直接使用javac*.java编译命令和java*运行命令。

(4) 但是应注意,在使用JDK1.4时,个别程序可能会无法正常编译运行(因JDK1.5的编程方式略有变化)。

所以应首选JDK1.5。

(5) 与在“环境变量”对话框中设置类路径相比,在命令提示符窗口中设置类路径是比较稳妥的方法。

因为用户存放程序代码的目录位置是根据内容不同而随时确定的。

此外您可能会发现“环境变量”对话框中的ClassPath设置在有些情况下毫无作用。

AddCourseInfo.java

importjava.awt.event.*;

importjava.awt.*;

importjavax.swing.*;

/**

 *课程信息管理模块

 *添加新的课程信息

 */

publicclassAddCourseInfoextendsCourseInfo{

 CrsBeangetCnum=newCrsBean();

 publicAddCourseInfo(){

  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);

  //设置运行位置,使对话框居中

  DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();

  this.setLocation((int)(screenSize.width-400)/2,

      (int)(screenSize.height-300)/2+45);

 }

 publicvoiddownInit(){

  addInfo.setText("增加");

  addInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(addInfo);

  clearInfo.setText("清空");

  clearInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(clearInfo);

  eixtInfo.setText("退出");

  eixtInfo.setFont(newFont("Dialog",0,12));

 *事件处理

 */

 publicvoidactionPerformed(ActionEvente){

  Objectobj=e.getSource();

  if(obj==eixtInfo){//退出

   this.dispose();

  }

  elseif(obj==addInfo){//增加

   cNum.setEnabled(false);

   cName.setEditable(false);

   cTeacher.setEditable(false);

   cType.setEditable(false);

   cTime.setEditable(false);

   cPlace.setEditable(false);

addInfo.setEnabled(false);

   clearInfo.setEnabled(false);

   eixtInfo.setEnabled(false);

   CrsBeanaddCrs=newCrsBean();

   addCrs.crsAdd(cName.getText(),cTeacher.getText(),cPlace.getText(),cType.getText(),cTime.getText());

   

   this.dispose();

   AddCourseInfoaci=newAddCourseInfo();

   aci.downInit();

   aci.pack();

   aci.setVisible(true);

   this.dispose();

  }

  elseif(obj==clearInfo){//清空

   setNull();

   cNum.setText(""+getCnum.getCrsId());543

        

JAVA学生管理系统

AddGradeInfo.java

importjava.awt.event.*;

importjava.awt.*;

importjavax.swing.*;

/**

 *成绩信息管理模块

 *添加新的成绩信息

 */

publicclassAddGradeInfoextendsGradeInfoimplementsActionListener{

 publicAddGradeInfo(){

  this.setTitle("添加成绩信息");

  this.setResizable(false);

  //设置运行位置,使对话框居中

  DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();

  this.setLocation((int)(screenSize.width-400)/2,

      (int)(screenSize.height-300)/2+45);

 }

 publicvoiddownInit(){

  addInfo.setText("增加");

  addInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(addInfo);

  eixtInfo.setText("退出");

  eixtInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(eixtInfo);

  this.contentPane.add(downPanel,BorderLayout.SOUTH);

  sNum.addActionListener(this);

  addInfo.addActionListener(this);

  eixtInfo.addActionListener(this);

 }

 /**

 *事件处理

 */

 publicvoidactionPerformed(ActionEvente){

  Objectobj=e.getSource();

  

  if(obj==addInfo){//增加

   cNum.setEnabled(false);

   cName.setEditable(false);

   cTeacher.setEditable(false);

   Grade.setEditable(false);

   sNum.setEditable(false);

   sName.setEditable(false);

∙口的位置

  DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();

  this.setLocation((screenSize.width-400)/2,

   (screenSize.height-300)/2+45);

 }

 publicvoiddownInit(){

  addInfo.setText("增加");

  addInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(addInfo);

  clearInfo.setText("清空");

  clearInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(clearInfo);

  eixtInfo.setText("退出");

  eixtInfo.setFont(newFont("Dialog",0,12));

  downPanel.add(eixtInfo);

  //添加事件侦听

 }

 /**

 *事件处理

 */

 publicvoidactionPerformed(ActionEvente){

  Objectobj=e.getSource();

  if(obj==eixtInfo){//退出

   this.dispose();

  }

  elseif(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(false);

   eixtInfo.setEnabled(false);

   StuBeanaddStu=newStuBean();

   addStu.stuAdd(sName.getText(),sSex.getText(),sBirth.getText(),sHome.getText(),sSethnic.getText(),sYear.getText(),sMajor.getText(),sCollege.getText());

   

   this.dispose();

   AddStuInfoasi=newAddStuInfo();

   asi.downInit();

   asi.pack();

   asi.setVisible(true);

  }

  elseif(obj==clearInfo){//清空

   setNull();

   sNum.setText(""+getSnum.getStuId());

          

JAVA学生管理系统

importjavax.swing.*;

importjava.awt.*;

importjava.awt.event.*;

import.*;

/**

 *课程信息综合管理类

 *提供主界面,供其他类继承

 */

publicclassCourseInfoextendsJFrameimplementsActionListener{

 ContainercontentPane;

 JPanelcenterPanel=newJPanel();

 JPanelupPanel=newJPanel();

 JPaneldownPanel=newJPanel();

 //框架的大小

 DimensionfaceSize=newDimension(800,500);

 JLabeljLabel1=newJLabel();

 JLabeljLabel2=newJLabel();

 JLabeljLabel3=newJLabel();

 JLabeljLabel4=newJLabel();

 JLabeljLabel5=newJLabel();

 JLabeljLabel6=newJLabel();

 JTextFieldcNum=newJTextField(15);

 JTextFieldcName=newJTextField(15);

 JTextFieldcTeacher=newJTextField(15);

 JTextFieldcType=newJTextField(15);

 JTextFieldcTime=newJTextField(15);

 JTextFieldcPlace=newJTextField(15);

 JButtonsearchInfo=newJButton();

 JButtonaddInfo=newJButton();

 JButtonmodifyInfo=newJButton();

 JButtondeleteInfo=newJButton();

 JButtonclearInfo=newJButton();

 JButtonsaveInfo=newJButton();

 JButtoneixtInfo=newJButton();

 GridBagLayoutgirdBag=newGridBagLayout();

 GridBagConstraintsgirdBagCon;

 publicCourseInfo(){this.setSize(faceSize);

  //设置标题

  this.setTitle("课程综合信息管理");

  this.setResizable(false);

  //设置程序图标

  this.setIconImage(getImage("icon.gif"));

  try {

   Init();

  }

  catch(Exception e){

   e.printStackTrace();

  }

 }

 publicvoidInit()throwsException{

  contentPane=this.getContentPane();

  contentPane.setLayout(newBorderLayout());

  //中部面板的布局

  centerPanel.setLayout(girdBag);

  jLabel1.setText("课程编码:

");

  jLabel1.setFont(newFont("Dialog",0,12));

  girdBa

gCon=newGridBagConstraints();

  girdBagCon.gridx=0;

  girdBagCon.gridy=0;

  girdBagCon.insets=newInsets(10,10,10,1);

  girdBag.setConstraints(jLabel1,girdBagCon);

  centerPanel.add(jLabel1);

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=1;

  girdBagCon.gridy=0;

  girdBagCon.insets=newInsets(10,1,10,15);

  girdBag.setConstraints(cNum,girdBagCon);

  centerPanel.add(cNum);

  jLabel2.setText("课程名称:

");

  jLabel2.setFont(newFont("Dialog",0,12));

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=2;

  girdBagCon.gridy=0;

  girdBagCon.insets=newInsets(10,15,10,1);

  girdBag.setConstraints(jLabel2,girdBagCon);

  centerPanel.add(jLabel2);

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=3;

  girdBagCon.gridy=0;

  girdBagCon.insets=newInsets(10,1,10,10);

  girdBag.setConstraints(cName,girdBagCon);

  centerPanel.add(cName);

  jLabel3.setText("授课老师:

");

  jLabel3.setFont(newFont("Dialog",0,12));

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=0;

  girdBagCon.gridy=1;

  girdBagCon.insets=newInsets(10,10,10,1);

  girdBag.setConstraints(jLabel3,girdBagCon);

  centerPanel.add(jLabel3);

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=1;

  girdBagCon.gridy=1;

  girdBagCon.insets=newInsets(10,1,10,15);

  girdBag.setConstraints(cTeacher,girdBagCon);

  centerPanel.add(cTeacher);

  jLabel4.setText("课程类别:

");

  jLabel4.setFont(newFont("Dialog",0,12));

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=2;

  girdBagCon.gridy=1;

  girdBagCon.insets=newInsets(10,15,10,1);

  girdBag.setConstraints(jLabel4,girdBagCon);

  centerPanel.add(jLabel4);

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=3;

  girdBagCon.gridy=1;

  girdBagCon.insets=newInsets(10,1,10,10);

  girdBag.setConstraints(cType,girdBagCon);

  centerPanel.add(cType);

  jLabel5.setText("上课时间:

");

  jLabel5.setFont(newFont("Dialog",0,12));

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=0;

  girdBagCon.gridy=2;

  girdBagCon.insets=newInsets(10,10,10,1);

  girdBag.setConstraints(jLabel5,girdBagCon);

  centerPanel.add(jLabel5);

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=1;

  girdBagCon.gridy=2;

  girdBagCon.insets=newInsets(10,1,10,15);

  girdBag.setConstraints(cTime,girdBagCon);

  centerPanel.add(cTime);

  jLabel6.setText("上课地点:

");

  jLabel6.setFont(newFont("Dialog",0,12));

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=2;

  girdBagCon.gridy=2;

  girdBagCon.insets=newInsets(10,15,10,1);

  girdBag.setConstraints(jLabel6,girdBagCon);

  centerPanel.add(jLabel6);

  girdBagCon=newGridBagConstraints();

  girdBagCon.gridx=3;

  girdBagCon.insets=newInsets(10,1,10,10);

  girdBag.setConstraints(cPlace,girdBagCon);

  centerPanel.add(cPla

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1