java课设--简单的学生成绩管理系统(可视化界面,连接MYsql数据库)

1.登录界面
package kk;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;

public class login extends JFrame {

	 JPanel contentPane;
	 JTextField t1;
	 String power;
	 private JPasswordField t2;
	 String zh,mm;
	 

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					login frame = new login();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	

	/**
	 * Create the frame.
	 */
	public login() {
		setResizable(false);
		setTitle("\u5B66\u751F\u6210\u7EE9\u7BA1\u7406\u7CFB\u7EDF");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 338, 283);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JLabel l1 = new JLabel("\u7528\u6237\u540D\uFF1A");
		l1.setFont(new Font("宋体", Font.PLAIN, 16));
		
		JLabel l2 = new JLabel("\u5BC6  \u7801\uFF1A");
		l2.setFont(new Font("宋体", Font.PLAIN, 16));
		
		t1 = new JTextField();
		t1.setColumns(10);
		
		
		JButton b1 = new JButton("\u767B\u5F55");
		b1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) { 
				 if((t1.getText()).equals("1516")&&(t2.getText()).equals("123"))
	              {
	       JOptionPane.showMessageDialog(null, "登录成功!用户权限是管理员");
	             power="管理员";
	            guanli  f = new guanli();
	             
	             f.setVisible(true);
	              
	              }
	              else if((t1.getText()).equals("15")&&(t2.getText()).equals("123456"))
	              {
	              JOptionPane.showMessageDialog(null, "登录成功!登录成功!用户权限是游客");
	              power="游客";
	              chaxun f = new chaxun();
	              f.setVisible(true);
	              }
	        else JOptionPane.showMessageDialog(null, "登录失败,请重新登录!");
	  }  

      
             
         
		});
		
		JButton b3 = new JButton("\u9000\u51FA");
		b3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			
					 System.exit(0);
			}
		});
		
		JButton b2 = new JButton("\u91CD\u7F6E");
		b2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
					t1.setText("");
					t2.setText("");
				
			}
		});
		
		t2 = new JPasswordField();
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addContainerGap(20, Short.MAX_VALUE)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addComponent(l1)
						.addComponent(l2)
						.addComponent(b1))
					.addGap(4)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createSequentialGroup()
							.addGap(44)
							.addComponent(b2)
							.addGap(42)
							.addComponent(b3))
						.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false)
							.addComponent(t2, Alignment.LEADING)
							.addComponent(t1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)))
					.addContainerGap(34, Short.MAX_VALUE))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGap(50)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(l1)
						.addComponent(t1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(49)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(l2)
						.addComponent(t2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(46)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(b1)
						.addComponent(b2)
						.addComponent(b3))
					.addContainerGap(35, Short.MAX_VALUE))
		);
		contentPane.setLayout(gl_contentPane);
		this.setLocationRelativeTo(null);
	}
}



	
2.管理界面



package kk;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;

public class guanli extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					guanli frame = new guanli();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public guanli() {
		setResizable(false);
		setTitle("\u7BA1\u7406\u5458\u767B\u5F55");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 463, 322);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JButton b1 = new JButton("\u67E5\u8BE2");
		b1.setFont(new Font("宋体", Font.PLAIN, 16));
		b1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				chaxun f = new  chaxun();
				  f.setVisible(true);
				
			}
		});
		
		JButton b2 = new JButton("\u589E\u52A0");
		b2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				zengjia f = new  zengjia();
				  f.setVisible(true);
			}
		});
		b2.setFont(new Font("宋体", Font.PLAIN, 16));
		
		JButton b3 = new JButton("\u4FEE\u6539");
		b3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				xiugai f = new  xiugai();
				  f.setVisible(true);
			}
		});
		b3.setFont(new Font("宋体", Font.PLAIN, 16));
		
		JButton b4 = new JButton("\u5220\u9664");
		b4.setFont(new Font("宋体", Font.PLAIN, 16));
		b4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				shanchu f = new  shanchu();
				  f.setVisible(true);
			}
		});
		
		JButton b5 = new JButton("\u5176\u4ED6");
		b5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				qita f = new  qita();
				  f.setVisible(true);
			}
		});
		b5.setFont(new Font("宋体", Font.PLAIN, 16));
		
		JButton b6 = new JButton("\u9000\u51FA");
		b6.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				shutDown();
			}
		});
		b6.setFont(new Font("宋体", Font.PLAIN, 16));
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addComponent(b1)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(b2)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(b3)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(b4)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(b5)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(b6)
					.addContainerGap(106, Short.MAX_VALUE))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGap(98)
					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
						.addComponent(b1)
						.addComponent(b2)
						.addComponent(b3)
						.addComponent(b4)
						.addComponent(b5)
						.addComponent(b6))
					.addContainerGap(131, Short.MAX_VALUE))
		);
		contentPane.setLayout(gl_contentPane);
		this.setLocationRelativeTo(null);
	}
	private void shutDown(){
		this.dispose();
	}
}

3.查询界面
package kk;


import java.awt.Color;
import java.awt.Container;
import java.awt.EventQueue;
import java.awt.GridLayout;
import java.awt.Window;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;



import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.awt.event.ActionEvent;
import java.awt.Dialog.ModalExclusionType;

public class chaxun extends JFrame {

	private JPanel contentPane;
	private JTextField t1;
	private JTextField t2;
	String s,t, r1, r2, r3, r4, r5,r6,r7,r8,r9,r10;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					chaxun frame = new chaxun();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public chaxun() {
		setResizable(false);
		
		setTitle("\u6210\u7EE9\u67E5\u8BE2");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBord
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值