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

📄 lau.java

📁 一个JAVA的学生管理系统,用的是GUI的图形用户界面.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		on.add("Center",userbase3);
		on.add("East",userbase2);
		
		on.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.green,1)));

		
		scrollpane.add("North",on);
		scrollpane.add("South",pa0);
		
		cp1.add(scrollpane_);
		
		f2.addWindowListener(new WinLis());
		f2.pack();
		f2.setVisible(true);
		
	}
	public void CheckPicture(){
		if(icon.getIconHeight()<1){
			icon = new ImageIcon("F:\\java\\计算机502  陈肖宇 05010064   课程设计\\用户照片\\nophoto.jpg");
		}
	}

	private class Insert implements ActionListener{
		public void actionPerformed(ActionEvent e){
			l1_2.setText("用户目前操作为:添加");
			InsertStudent insertstuden=new InsertStudent();
			insertstuden.InsertStudent();
		}
	}
	private class Update implements ActionListener{
		public void actionPerformed(ActionEvent e){
			l1_2.setText("用户目前操作为:修改");
			String filename=null,newvalue=null,updatename=null;
			filename=JOptionPane.showInputDialog(b,"请您输入要修改的字段名,只能为:\nname,number,grade,\nclanguage,english,maths","修改学生信息",JOptionPane.INFORMATION_MESSAGE);
			if(filename!=null)updatename=JOptionPane.showInputDialog(b,"请您输入要修改的姓名","修改学生信息",JOptionPane.INFORMATION_MESSAGE);
			if(updatename!=null)newvalue=JOptionPane.showInputDialog(b,"您想将其改为:","修改学生信息",JOptionPane.INFORMATION_MESSAGE);
			try{
				StudentSql updatesql=new StudentSql();
				updatesql.Update(filename,newvalue,updatename);
				ta2_2_1.append("修改成功!\n");
			}catch(Exception in){
				JOptionPane.showMessageDialog(b,"修改失败!","对话框",JOptionPane.ERROR_MESSAGE);
			}
		}
	}
	private class NameSelect implements ActionListener{
		public void actionPerformed(ActionEvent e){
			chooseselectway=1;
			l1_2.setText("用户目前操作为:姓名查找");
			name=JOptionPane.showInputDialog(b,"请您输入学生姓名!","姓名查找",JOptionPane.INFORMATION_MESSAGE);
			try{
				StudentSql selectsql=new StudentSql();
				selectsql.Fuzhi1(name);
				tf2_1.setText(selectsql.selname);
				tf2_2.setText(selectsql.selnumber);
				tf2_3.setText(selectsql.selgrade);
				tf2_1_1_1.setText(selectsql.selclanguage);
				tf2_1_1_2.setText(selectsql.selenglish);
				tf2_1_1_3.setText(selectsql.selmaths);
				ImageIcon icon= new ImageIcon("F:\\java\\计算机502  陈肖宇 05010064   课程设计\\用户照片\\"+name+".jpg");
				ic.setIcon(icon);
				f2.pack();
				if(selectsql.selname!=null){
					ta2_2_1.append("姓名查找成功!\n");
				}else ta2_2_1.append("该学生不存在!\n");
				
			}catch(Exception se){
				JOptionPane.showMessageDialog(b,"姓名查找失败!","对话框",JOptionPane.ERROR_MESSAGE);
			}
		}
	}
	private class NumSelect implements ActionListener{
		public void actionPerformed(ActionEvent e){
			chooseselectway=0;
			l1_2.setText("用户目前操作为:学号查找");
			number=JOptionPane.showInputDialog(b,"请您输入学生学号!","学号查找",JOptionPane.INFORMATION_MESSAGE);
			try{
				StudentSql selectsql=new StudentSql();
				selectsql.Fuzhi2(number);
				tf2_1.setText(selectsql.selname);
				tf2_2.setText(selectsql.selnumber);
				tf2_3.setText(selectsql.selgrade);
				tf2_1_1_1.setText(selectsql.selclanguage);
				tf2_1_1_2.setText(selectsql.selenglish);
				tf2_1_1_3.setText(selectsql.selmaths);
				ImageIcon icon= new ImageIcon("F:\\java\\计算机502  陈肖宇 05010064   课程设计\\用户照片\\"+selectsql.selname+".jpg");
				ic.setIcon(icon);
				f2.pack();
				if(selectsql.selname!=null){
					ta2_2_1.append("学号查找成功!\n");
				}else ta2_2_1.append("该学生不存在!\n");
			}catch(Exception se){
				JOptionPane.showMessageDialog(b,"学号查找失败!","对话框",JOptionPane.ERROR_MESSAGE);
			}
		}
	}
	private class Delete implements ActionListener{
		public void actionPerformed(ActionEvent e) {
			l1_2.setText("用户目前操作为:删除");
			String deletename=JOptionPane.showInputDialog(b,"请您输入学生姓名!","删除学生",JOptionPane.INFORMATION_MESSAGE);
			int yes=JOptionPane.showConfirmDialog(b,"您确定要删除这个学生吗?","删除学生",JOptionPane.OK_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
			if(yes==JOptionPane.OK_OPTION){
				try{
					StudentSql delsql=new StudentSql();
					delsql.Delete(deletename);
					ta2_2_1.append("删除成功!\n");
				}catch(Exception de){
					JOptionPane.showMessageDialog(b,"删除失败!","对话框",JOptionPane.ERROR_MESSAGE);	
				}
			}
		}
	}
	private class Goback implements ActionListener{
		pp2 a=null;
		public void actionPerformed(ActionEvent e) {
			f2.dispose();
			a=new pp2();
			a.pp2();
		}
	}
	private class Clean implements ActionListener{
		public void actionPerformed(ActionEvent e){
			l1_2.setText("用户目前操作为:刷新/信息框已刷新!");
			ta2_2_1.setText("");
			tf2_1.setText("无用户");tf2_2.setText("无用户学号");
			tf2_3.setText("西安交通大学**学院");
			tf2_1_1_1.setText("0");tf2_1_1_2.setText("0");tf2_1_1_3.setText("0");
			icon=null;
			ic.setIcon(icon);
			f2.pack();
		}
	}
	private class Qian implements ActionListener{
		public void actionPerformed(ActionEvent e){
			
		}
	}
	private class Next implements ActionListener{
		public void actionPerformed(ActionEvent e){
			
		}
	}
	private class More extends MouseAdapter{
		public void mouseClicked(MouseEvent me){
			pa3_1.setBackground(Color.blue);
			pa3_2.setBackground(Color.white);
			pa3_3.setBackground(Color.white);
			String more="    在这里打算把查找到的学\n";
					more+="生的信息,更多的显示在这里,\n";
					more+="做为用户想了解所查学生的更多\n";
					more+="详细信息,此技术正在研究,希\n";
					more+="望能在不久的将来能与大家见面\n";
					more+="在此先谢过大家,耐心等待!\n";
			StudentSql ab=new StudentSql();
			try{
				if(chooseselectway==1)ab.Fuzhi1(name);
				else if(chooseselectway==0)ab.Fuzhi2(number);
				more=ab.selmore;
			}catch(Exception e){
				more+="加载没有成功";
				}		
			ta2_2_1.append(more+"\n");
		}
	}
	private class Help extends MouseAdapter{
		public void mouseClicked(MouseEvent me){
			pa3_1.setBackground(Color.white);
			pa3_2.setBackground(Color.blue);
			pa3_3.setBackground(Color.white);
			String help="在进行操作时应先按按钮,\n";
			help+="系统会自动弹出对话框给您进一\n";
			help+="步提示,。。。,想到了再写吧,\n";
			help+="总之你有哪不会问我不行了。\n";
			JOptionPane.showMessageDialog(b,help,"Help",JOptionPane.PLAIN_MESSAGE);
		}
	}
	private class UserUpdate extends MouseAdapter{
		public void mouseClicked(MouseEvent me){
			pa3_1.setBackground(Color.white);
			pa3_2.setBackground(Color.white);
			pa3_3.setBackground(Color.blue);
			String newpassword=null;
			newpassword=JOptionPane.showInputDialog(b,"请您输入新的登录密码","修改登录密码",JOptionPane.INFORMATION_MESSAGE);
			if(newpassword!=null)
			try{
				UserSql a=new UserSql();
				a.UserUpdate(newpassword,loadid_);
				ta2_2_1.append("修改登录密码成功!\n");
			}catch(Exception e){
				ta2_2_1.append("修改登录密码失败!\n");
			}
		}
	}
	private class WinLis extends WindowAdapter{
		public void windowClosing(WindowEvent we){
			System.exit(0);
		}
	}

}

⌨️ 快捷键说明

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