赞
踩
基于Java swing+MySQL实现学生信息管理系统:功能:1录入学生基本信息的功能; 2查询学生基本信息的功能; 3修改学生基本信息的功能 ;4删除学生基本信息的功能 ;5显示所有学生信息的功能;应付一般课设足矣,分享给大家。
如有需要:https://pan.baidu.com/s/1JqLFKPlmhV2INeETy9lHAQ
提取码:nima
里面包括了所有代码源文件+mysql8.0.25驱动jar包+登录页面时的背景图345.jpg
1.开发环境:jdk11+win10+mysql 8+IDEA
记得将数据库与IDEA或者eclipse连接起来,并记得添加数据库驱动jar包
这两个分别是添加jar包和idea连接mysql大家可以做一下参考
IDEA导入mysql数据库驱动_跟着太阳.的博客-CSDN博客[这里是图片004]https://blog.csdn.net/qq_54705917/article/details/123484397?spm=1001.2014.3001.5502IDEA连接mysql数据库_跟着太阳.的博客-CSDN博客[这里是图片005]https://blog.csdn.net/qq_54705917/article/details/123484737?spm=1001.2014.3001.5502
2.数据库设计
代码:
库:create databasestudent
表:create table stu(
stuId varchar(20),
stuName varchar(20),
stuSex varchar(20),
stuAge varchar(20),
stuJG varchar(20),
stuLX varchar(20),
stuBJ varchar(20)
);
3. 窗口及功能设计
(1).主函数
main.java
import javax.swing.*;
public class main {
public static void main(String[] args) {
JFrame jf = new StuLogin();
}
}
(2).登录界面(默认的账号密码都为:admin)
StuLogin.java
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class StuLogin extends JFrame { private StuLogin self; private ImageIcon imageIcon; private Image image; private String userid;// 登陆用户名和密码 private String password; private JLabel unLabel = new JLabel("账号:");// 登陆面板控件 private JTextField unField = new JTextField(); private JLabel pwLabel = new JLabel("密码:"); private JPasswordField pwField = new JPasswordField(); private JButton dl = new JButton("登录"); private JButton d2 = new JButton("重置"); public StuLogin() { this.self = this; this.setSize(350, 300);// 设置登陆面板 设置窗口背景图 //先将contentPane设置成透明的 ((JPanel)getContentPane()).setOpaque(false); //再设置图片 imageIcon = new ImageIcon("345.jpg");//图标组件 image = imageIcon.getImage(); JLabel imgLabel = new JLabel(imageIcon); getLayeredPane().add(imgLabel, new Integer(Integer.MIN_VALUE)); imgLabel.setBounds(0,0,400,300); //背景图片的位置 this.setIconImage(image);//设置窗口图像 this.setLocation(600,300); this.setVisible(true); this.setResizable(false); this.setLayout(null); // this.getContentPane().setBackground(Color.BLACK);设置窗口背景色; //设置窗口名称 this.setTitle("学生信息管理系统"); unLabel.setSize(50, 30); unLabel.setLocation(60, 40); unLabel.setForeground(Color.red); unLabel.setFont(new Font("楷体",Font.BOLD,15)); unField.setSize(150, 35); unField.setLocation(110, 35); pwLabel.setSize(50, 30); pwLabel.setLocation(60, 100); pwLabel.setForeground(Color.red); pwLabel.setFont(new Font("楷体",Font.BOLD,15)); pwField.setSize(150, 35); pwField.setLocation(110, 100); dl.setSize(80, 35); dl.setLocation(65, 175); dl.setBackground(Color.red); d2.setSize(80, 35); d2.setLocation(185, 175); d2.setBackground(Color.red); dl.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { userid = unField.getText(); password = pwField.getText(); if(userid.equals("admin")&&password.equals("admin")) { self.setVisible(false); // JOptionPane.showMessageDialog(nul
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。