• 大小: 74KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-02
  • 语言: Java
  • 标签:

资源简介

java学生成绩管理系统界面设计

资源截图

代码片段和文件信息

package com.studensystem;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import com.studensystem.SqlHelper;
public class AddForm extends Jframe implements ActionListener
{
  JLabel labName=new JLabel(“姓名:“);
   JLabel labDate=new JLabel(“出生日期:“);
   JLabel labScore=new JLabel(“成绩:“);
   JTextField txtName=new JTextField(20);
   JTextField txtDate=new JTextField(18);
  JTextField txtScore=new JTextField(20);
   JButton btnAdd=new JButton(“添加“);
   JButton btnCancel=new JButton(“取消“);
   JPanel pan=new JPanel();
   JPanel pan1=new JPanel();
   JPanel pan2=new JPanel();
   JPanel pan3=new JPanel();
   JPanel pan4=new JPanel();
   Connection con;
   Statement sql;
   ResultSet rs;  
   AddForm()
   {
       super(“添加数据“);
       setSize(400300);
       pan1.add(labName);
       pan1.add(txtName);
       pan2.add(labDate);
       pan2.add(txtDate);
       pan3.add(labScore);
       pan3.add(txtScore);
       pan4.add(btnAdd);
     pan4.add(btnCancel);
      pan.setLayout(new GridLayout(31));
      pan.add(pan1);
       pan.add(pan2);
       pan.add(pan3);
       getContentPane().add(pan“Center“);
       getContentPane().add(pan4“South“);
       btnAdd.addActionListener(this);
       btnCancel.addActionListener(this);
       btnAdd.setEnabled(true);
       txtDate.setEditable(true);        
        txtScore.setEditable(true);
       setVisible(true);
       txtName.requestFocus();
   }
   public void actionPerformed(ActionEvent ae)
   {
       String recodeinsert1stu_timeusername;
       int stu_score;
       if(ae.getSource()==btnCancel)
       {
          this.dispose();
      } 
       else if(ae.getSource()==btnAdd)
               {
                  try
                   {
                       Class.forName(“com.mysql.jdbc.Driver“);
                       }
                      catch(ClassNotFoundException e){   
                      }
                       try{con=DriverManager.getConnection(“driver““user““passwd“);
                       sql=con.createStatement();
                       username=txtName.getText();
                       stu_time=txtDate.getText();
                       stu_score=Integer.parseInt(txtScore.getText());
                 // recode=“(“+“‘“+username+“‘“+““+“‘“+stu_time+““+“‘“+stu_score+“)“;
                   //   insert1=“insert into student values “+recode;
                       insert1=“insert into student values(???) “;
                       sql.executeUpdate(insert1);
                       System.out.println(“记录添加完毕!“);
                       btnAdd.setEnabled(false);
                       txtName.setText(““);
                       txtScore.setText(““);
                       txtDate.setText(““);
                       con.close();
                   }
                      catch(SQLException e){
                       }
               }
       }
           public s

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-07-05 18:36  javase\
     文件         399  2019-07-05 13:50  javase\.classpath
     文件         382  2018-06-11 16:31  javase\.project
     目录           0  2019-07-05 18:27  javase\.settings\
     文件         598  2018-06-11 16:31  javase\.settings\org.eclipse.jdt.core.prefs
     目录           0  2019-07-05 18:27  javase\bin\
     目录           0  2019-07-05 18:27  javase\bin\com\
     目录           0  2019-07-05 18:27  javase\bin\com\studensystem\
     文件        3792  2019-07-05 18:17  javase\bin\com\studensystem\AddForm.class
     文件        4771  2019-07-05 15:58  javase\bin\com\studensystem\DeleteForm.class
     文件        3165  2019-07-05 15:21  javase\bin\com\studensystem\MainForm.class
     文件        4747  2019-07-05 15:56  javase\bin\com\studensystem\ModifyForm.class
     文件         736  2019-07-05 15:21  javase\bin\com\studensystem\MyPanel.class
     文件        4336  2019-07-05 15:57  javase\bin\com\studensystem\NameQueryForm.class
     文件        4341  2019-07-05 15:43  javase\bin\com\studensystem\ScoreQueryForm.class
     文件        2390  2019-07-05 15:24  javase\bin\com\studensystem\SqlHelper.class
     文件        2863  2019-07-05 13:50  javase\bin\com\studensystem\StuAddDialog.class
     文件        1168  2019-07-05 13:50  javase\bin\com\studensystem\StuModel.class
     目录           0  2019-07-05 18:27  javase\src\
     目录           0  2019-07-05 18:27  javase\src\com\
     目录           0  2019-07-05 18:27  javase\src\com\studensystem\
     文件        3144  2019-07-05 18:17  javase\src\com\studensystem\AddForm.java
     文件        4150  2019-07-05 15:58  javase\src\com\studensystem\DeleteForm.java
     文件        2642  2019-07-05 15:21  javase\src\com\studensystem\MainForm.java
     文件        3826  2019-07-05 15:56  javase\src\com\studensystem\ModifyForm.java
     文件        3281  2019-07-05 15:57  javase\src\com\studensystem\NameQueryForm.java
     文件        3304  2019-07-05 15:43  javase\src\com\studensystem\ScoreQueryForm.java
     文件        2753  2019-07-05 15:24  javase\src\com\studensystem\SqlHelper.java
     文件         714  2019-07-05 18:35  javase\student.sql
     目录           0  2019-07-05 18:31  javase\截图\
     文件       17018  2019-07-05 18:30  javase\截图\1.JPG
............此处省略4个文件信息

评论

共有 条评论