⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studentmanage.java

📁 通过JAVA语言编写的学生信息管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Studentmanage extends JFrame{
	CardLayout cardlayout1=new CardLayout();
	JPanel p=new JPanel();
	
	//输入窗体部分控件
	JTextField it1=new JTextField(10);
	JTextField it2=new JTextField(10);
	JTextField it4=new JTextField(10);
	JTextField it5=new JTextField(10);
	JTextField it6=new JTextField(10);
	ButtonGroup iradioGroup = new ButtonGroup();
	JRadioButton irb1=new JRadioButton("男",true);
	JRadioButton irb2=new JRadioButton("女");
	//修改窗体部分控件 
	JTextField ct1=new JTextField(4);
	JTextField ct2=new JTextField(20);
	JTextField ct4=new JTextField(20);
	JTextField ct5=new JTextField(20);
	JTextField ct6=new JTextField(20);
	JButton cb2=new JButton("录入修改");
	ButtonGroup cradioGroup = new ButtonGroup();
	JRadioButton crb1=new JRadioButton("男");
	JRadioButton crb2=new JRadioButton("女");
	//删除窗体部分控件
	JTextField dt1=new JTextField(7);
	JTextField dt2=new JTextField(20);
	JTextField dt4=new JTextField(20);
	JTextField dt5=new JTextField(20);
	JTextField dt6=new JTextField(20);
	JButton db2=new JButton("删除");
	ButtonGroup dradioGroup = new ButtonGroup();
	JRadioButton drb1=new JRadioButton("男");
	JRadioButton drb2=new JRadioButton("女");
	
	//构造函数
	public Studentmanage(){
		
		//输入窗体
		JLabel il1=new JLabel("学号:");
		JLabel il2=new JLabel("姓名:");
		JLabel il3=new JLabel("性别:");
		
		iradioGroup.add(irb1);
		iradioGroup.add(irb2);
		JLabel il4=new JLabel("专业:");
		JLabel il5=new JLabel("年级:");
		JLabel il6=new JLabel("出生:");
		JButton ib1=new JButton("录入");
		JButton ib2=new JButton("重置");
		JPanel p2=new JPanel(new BorderLayout());
		JPanel ig=new JPanel(new GridLayout(6,1));
		JPanel ij=new JPanel(new FlowLayout());
		ij.add(ib1);
		ij.add(ib2);
		p2.add(ij,BorderLayout.SOUTH);
		
		JPanel ip2=new JPanel(new FlowLayout());
		JPanel ip3=new JPanel(new FlowLayout());
		JPanel ip4=new JPanel(new FlowLayout());
		JPanel ip5=new JPanel(new FlowLayout());
	 	JPanel ip6=new JPanel(new FlowLayout());
		JPanel ip7=new JPanel(new FlowLayout());
		ip2.add(il1);ip2.add(it1);
		ip3.add(il2);ip3.add(it2);
		ip4.add(il3);ip4.add(irb1);ip4.add(irb2);
		ip5.add(il4);ip5.add(it4);
		ip6.add(il5);ip6.add(it5);
		ip7.add(il6);ip7.add(it6);
		ig.add(ip2);
		ig.add(ip3);
		ig.add(ip4);
		ig.add(ip5);
		ig.add(ip6);
		ig.add(ip7);
		p2.add(ig,BorderLayout.NORTH);
		
		//修改窗体
		JLabel cl1=new JLabel("输入要修改信息的学号:");
		JLabel cl2=new JLabel("(新)姓名:");
		JLabel cl3=new JLabel("(新)性别:");
		cradioGroup.add(crb1);
		cradioGroup.add(crb2);
		JLabel cl4=new JLabel("(新)专业:");
		JLabel cl5=new JLabel("(新)年级:");
		JLabel cl6=new JLabel("(新)出生:");
		JButton cb1=new JButton("开始修改");
		JButton cb3=new JButton("重置");
		cb2.setEnabled(false);
		
		JPanel p3=new JPanel(new BorderLayout());	
		JPanel cg=new JPanel(new GridLayout(6,1));
		JPanel cj=new JPanel(new FlowLayout());
		cj.add(cb2);
		cj.add(cb3);
		p3.add(cj,BorderLayout.SOUTH);
		
		JPanel cp2=new JPanel(new FlowLayout());
		JPanel cp3=new JPanel(new FlowLayout());
		JPanel cp4=new JPanel(new FlowLayout());
		JPanel cp5=new JPanel(new FlowLayout());
	 	JPanel cp6=new JPanel(new FlowLayout());
		JPanel cp7=new JPanel(new FlowLayout());
		cp2.add(cl1);cp2.add(ct1);cp2.add(cb1);
		cp3.add(cl2);cp3.add(ct2);
		cp4.add(cl3);cp4.add(crb1);cp4.add(crb2);
		cp5.add(cl4);cp5.add(ct4);
		cp6.add(cl5);cp6.add(ct5);
		cp7.add(cl6);cp7.add(ct6);
		cg.add(cp2);
		cg.add(cp3);
		cg.add(cp4);
		cg.add(cp5);
		cg.add(cp6);
		cg.add(cp7);
		p3.add(cg,BorderLayout.NORTH);
		
		//删除窗体
		JLabel dl1=new JLabel("输入要删除的学号:");
		JLabel dl2=new JLabel("姓名:");
		JLabel dl3=new JLabel("性别:");
		dt2.setEditable(false);
		dt4.setEditable(false);
		dt5.setEditable(false);
		dt6.setEditable(false);
		ButtonGroup dradioGroup = new ButtonGroup();
		dradioGroup.add(drb1);
		dradioGroup.add(drb2);
		JLabel dl4=new JLabel("专业:");
		JLabel dl5=new JLabel("年级:");
		JLabel dl6=new JLabel("出生:");
		JButton db1=new JButton("显示");
		db2.setEnabled(false);
		JButton db3=new JButton("重置");
		JPanel dj=new JPanel(new FlowLayout());
		dj.add(db2);
		dj.add(db3);

		JPanel p4=new JPanel(new BorderLayout());
		JPanel dg=new JPanel(new GridLayout(6,1));
		
		JPanel dp2=new JPanel(new FlowLayout());
		JPanel dp3=new JPanel(new FlowLayout());
		JPanel dp4=new JPanel(new FlowLayout());
		JPanel dp5=new JPanel(new FlowLayout());
	 	JPanel dp6=new JPanel(new FlowLayout());
		JPanel dp7=new JPanel(new FlowLayout());
		dp2.add(dl1);dp2.add(dt1);dp2.add(db1);
		dp3.add(dl2);dp3.add(dt2);
		dp4.add(dl3);dp4.add(drb1);dp4.add(drb2);
		dp5.add(dl4);dp5.add(dt4);
		dp6.add(dl5);dp6.add(dt5);
		dp7.add(dl6);dp7.add(dt6);
		dg.add(dp2);
		dg.add(dp3);
		dg.add(dp4);
		dg.add(dp5);
		dg.add(dp6);
		dg.add(dp7);
		p4.add(dg,BorderLayout.NORTH);
		p4.add(dj,BorderLayout.SOUTH);
		
		//主窗体
		JFrame f=new JFrame();		
		ImageIcon icon=new ImageIcon("1.gif");
		
		JMenuBar bar = new JMenuBar();
		JMenu m=new JMenu("菜单选项");
		JMenu n=new JMenu("帮助");
		JMenuItem about=new JMenuItem("关于");
		JMenuItem input=new JMenuItem("登入学生基本信息");
		JMenuItem change=new JMenuItem("修改学生基本信息");
		JMenuItem find=new JMenuItem("查询学生基本信息");
		JMenuItem delete=new JMenuItem("删除学生基本信息");
		JMenuItem exit = new JMenuItem("退出");
		exit.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				System.exit(0);
			}
		});
		
		m.add(input);
		m.add(change);
		m.add(find);
		m.add(delete);
		m.add(exit);
		n.add(about);
		bar.add(m);
		bar.add(n);
	
		JLabel l=new JLabel("欢迎使用学生基本信息管理系统",JLabel.CENTER);
		l.setForeground(Color.red);
		l.setFont(new Font("华文彩云",Font.PLAIN,30));
		JLabel ht1=new JLabel("制作人:",JLabel.CENTER);
		JLabel ht2=new JLabel("软件学院.03软件(2)班.张洋",JLabel.CENTER);
		JLabel ht3=new JLabel("QQ:282576335",JLabel.CENTER);
		ht1.setForeground(Color.white);
		ht2.setForeground(Color.white);
		ht3.setForeground(Color.white);
		ht1.setFont(new Font("华文仿宋",Font.BOLD,50));
		ht2.setFont(new Font("华文仿宋",Font.BOLD,30));
		ht3.setFont(new Font("华文仿宋",Font.BOLD,30));
		JPanel h=new JPanel(new GridLayout(3,1));
		JPanel h1=new JPanel(new BorderLayout());
		h1.add(h,BorderLayout.CENTER);
		h.add(ht1);h.add(ht3);h.add(ht2);
		h.setBackground(Color.green);
		Container c=f.getContentPane();
		c.setLayout(new BorderLayout());
		c.add(bar,BorderLayout.NORTH);
		c.add(p,BorderLayout.CENTER);
	
	
		p.setLayout(cardlayout1);
		JPanel p1=new JPanel(new BorderLayout());
		p1.setBackground(Color.green);
		p1.add(l,BorderLayout.CENTER);
		p.add("Label",p1);
		p.add("Input",p2);
		p.add("Change",p3);
		p.add("Delete",p4);
		p.add("About",h1);
		f.setTitle("Student Manage");
		f.setIconImage(icon.getImage());
		f.setBounds(250,200,520,350);
		f.setVisible(true);
		
		
		//设置菜单的事件

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -