Eclipse+Java+Swing实现学生信息管理系统

一、系统介绍

本系统采用Java Swing技术实现系统登录登出功能,实现密码修改功能,实现学生信息简单的增删改查。

二、系统展示


登录
主页面
关于系统
查询
模糊查询
修改
添加
修改密码

三、代码

MainMenuFrame.Java

package com.sjsq.view;

import java.awt.Font;

import java.awt.Rectangle;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTextArea;

import org.jb2011.lnf.beautyeye.ch3_button.BEButtonUI;

/*

* 登陆成功后主界面

*/

public class MainMenuFrame extends JFrame implements ActionListener{

private JFrame mainmenu;

private JTextArea text;

// 标题栏(关于)

private JMenuBar menuBar1;

private JMenuItem aboutSystem;

public MainMenuFrame() {

mainmenu();

}

public void mainmenu() {

mainmenu = new JFrame("极客大学学生管理系统");

setLocationRelativeTo(null);// 将容器显示在屏幕中央

mainmenu.setSize(850, 650);

mainmenu.getContentPane().add(new JScrollPane(text));

JPanel jContentPane = new JPanel();

jContentPane.setLayout(null);

// 查询学生按钮

JButton jButtonSelect = new JButton();

jButtonSelect.setBounds(new Rectangle(320, 100, 100, 52));

jButtonSelect.setText("查询学生");

jButtonSelect.setUI(new BEButtonUI()

.setNormalColor(BEButtonUI.NormalColor.lightBlue));

getRootPane().setDefaultButton(jButtonSelect);// 回车登录

// 添加学生按钮

JButton jButtonAdd = new JButton();

jButtonAdd.setUI(new BEButtonUI()

.setNormalColor(BEButtonUI.NormalColor.lightBlue));

jButtonAdd.setBounds(new Rectangle(320, 200, 100, 52));

jButtonAdd.setText("添加学生");

// 修改密码按钮

JButton jButtonAlterPwd = new JButton();

jButtonAlterPwd.setUI(new BEButtonUI()

.setNormalColor(BEButtonUI.NormalColor.lightBlue));

jButtonAlterPwd.setBounds(new Rectangle(320, 300, 100, 52));

jButtonAlterPwd.setText("密码修改");

// 退出系统按钮

JButton jButtonExit = new JButton();

jButtonExit.setUI(new BEButtonUI()

.setNormalColor(BEButtonUI.NormalColor.lightBlue));

jButtonExit.setBounds(new Rectangle(320, 400, 100, 52));

jButtonExit.setText("退出系统");

jContentPane.add(jButtonSelect, null);

jContentPane.add(jButtonAdd, null);

jContentPane.add(jButtonAlterPwd, null);

jContentPane.add(jButtonExit, null);

// 添加Label到Frame

mainmenu.getContentPane().add(jContentPane);

// 设置字体

Font font = new Font("微软雅黑",Font.BOLD,16);

// 标题栏

menuBar1 = new JMenuBar();

//aboutSystem = new JMenuItem("关于本系统",new ImageIcon("src/images/icons/about.png"));

aboutSystem = new JMenuItem("关于本系统");

aboutSystem.setMnemonic('H');

menuBar1.add(aboutSystem);

// 查询学生

jButtonSelect.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

System.out.println("------查询学生-----");

QueryStudentInfo queryStudentInfo = new QueryStudentInfo();

}

});

// 添加学生

jButtonAdd.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

System.out.println("------添加学生-----");

AddStudentInfo addStudentInfo = new AddStudentInfo();

}

});

// 修改密码

jButtonAlterPwd.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

System.out.println("------修改密码-----");

ModifyPasswordInfo modifyPasswordInfo = new ModifyPasswordInfo();

}

});

// 退出系统

jButtonExit.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

System.out.println("------退出系统-----");

System.exit(1);

}

});

// 关于系统

aboutSystem.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

System.out.println("------关于系统------");

AboutSystem aboutSystem = new AboutSystem();

}

});

// 关闭窗口监控

mainmenu.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent arg0) {

System.exit(1);

}

});

mainmenu.setJMenuBar(menuBar1);

mainmenu.setVisible(true);

mainmenu.setLocation(250, 50);

aboutSystem.addActionListener(this);

}

// 主函数测试

public static void main(String[] args) {

new MainMenuFrame();

}

@Override

public void actionPerformed(ActionEvent arg0) {

}

}

四、联系方式


你可能感兴趣的:(Eclipse+Java+Swing实现学生信息管理系统)