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

📄 sms.java

📁 java课程设计——学生信息管理系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		fchangefalse.setSize(300,140);
		fchangefalse.setVisible(true);
		fchangefalse.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			fchangefalse.dispose(); 
		}
	}
}

class ChangeFalse1 implements ActionListener{
	JFrame fchangefalse1;
	JPanel pchangefalse1;
	JLabel lchangefalse1,lb;
	JButton btsure;
	void go(){
		Font h = new Font("楷体", Font.BOLD, 18);
		lb = new JLabel(new ImageIcon("2.jpg"));
		fchangefalse1 = new JFrame("修改不成功");
		pchangefalse1 = new JPanel();
		pchangefalse1.setLayout(null);
		lchangefalse1 = new JLabel("该学号已存在!");
		btsure = new JButton("确 定");
		lchangefalse1.setFont(h);
		btsure.setFont(h);
		lchangefalse1.setForeground(Color.red);
		btsure.setForeground(Color.blue);
		pchangefalse1.add(lchangefalse1);
		pchangefalse1.add(btsure);
		pchangefalse1.add(lb);
		fchangefalse1.add(pchangefalse1,"Center");
		lchangefalse1.setBounds(80,25,150,30);
		btsure.setBounds(180,60,90,30);
		lb.setBounds(0,0,300,140);
		btsure.addActionListener(this);
		fchangefalse1.setLocation(530,400);
		fchangefalse1.setSize(300,140);
		fchangefalse1.setVisible(true);
		fchangefalse1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			fchangefalse1.dispose(); 
		}
	}
}

class ChangeSearchFrame_True implements ActionListener{
	Font h = new Font("楷体", Font.BOLD, 18);
	JFrame fchangetrue;
	JPanel pchangetrue;
	JLabel lchangetrue,lb;
	JButton btsure;
	void go(){
		lb = new JLabel(new ImageIcon("2.jpg"));
		fchangetrue = new JFrame("修改结果");
		pchangetrue = new JPanel();
		pchangetrue.setLayout(null);
		lchangetrue = new JLabel("修改成功!");
		btsure = new JButton("确 定");
		lchangetrue.setFont(h);
		btsure.setFont(h);
		lchangetrue.setForeground(Color.red);
		btsure.setForeground(Color.blue);
		pchangetrue.add(lchangetrue);
		pchangetrue.add(btsure);
		pchangetrue.add(lb);
		fchangetrue.add(pchangetrue,"Center");
		lchangetrue.setBounds(100,25,120,30);
		btsure.setBounds(180,60,90,30);
		lb.setBounds(0,0,300,140);
		btsure.addActionListener(this);
		fchangetrue.setLocation(530,400);
		fchangetrue.setSize(300,140);
		fchangetrue.setVisible(true);
		fchangetrue.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			fchangetrue.dispose(); 
		}
	}
}

class SearchFrame implements ActionListener{
	Font h = new Font("楷体", Font.BOLD, 18);
	JFrame fsearch;
	JPanel psearch;
	JLabel lbnumber,lb;
	JTextField tfnumber;
	JButton btsure;
	void go(){
		lb = new JLabel(new ImageIcon("3.jpg"));
		fsearch = new JFrame("查询");
		psearch = new JPanel();
		psearch.setLayout(null);
		lbnumber = new JLabel("学号");
		tfnumber = new JTextField();
		btsure = new JButton("确 定");
		lbnumber.setFont(h);
		btsure.setFont(h);
		lbnumber.setForeground(Color.yellow);
		btsure.setForeground(Color.blue);
		psearch.add(lbnumber);
		psearch.add(tfnumber);
		psearch.add(btsure);
		psearch.add(lb);
		fsearch.add(psearch,"Center");
		lbnumber.setBounds(50,30,40,30);
		tfnumber.setBounds(100,30,180,30);
		btsure.setBounds(200,80,100,30);
		lb.setBounds(0,0,350,160);
		fsearch.setLocation(500,300);
		fsearch.setSize(350,160);
		fsearch.setVisible(true);
		fsearch.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		btsure.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			if(tfnumber.getText().equals(""))
			{
				fsearch.dispose();
				SearchError searcherror = new SearchError();
				searcherror.go();
				return;
			}
			int o=0;
			for(int p=0;p<=SMS.i;p++){
				if(SMS.student[p][0].toString().equals(tfnumber.getText())){
					o++;
					SMS.m=p;
					break;
				}
			}
			if(o==0){
				fsearch.dispose();
				SearchNo searchno = new SearchNo();
				searchno.go();
				return;
			}
			fsearch.dispose(); 
			SearchResultFrame searchresultframe = new SearchResultFrame();
			searchresultframe.go();
		}
	}	
}

class SearchError implements ActionListener{
	JFrame fsearchError;
	JPanel psearchError;
	JLabel lsearchError,lb;
	JButton btsure;
	void go(){
		Font h = new Font("楷体", Font.BOLD, 18);
		lb = new JLabel(new ImageIcon("2.jpg"));
		fsearchError = new JFrame("查询出错");
		psearchError = new JPanel();
		psearchError.setLayout(null);
		lsearchError = new JLabel("必须输入学号!");
		btsure = new JButton("确 定");
		lsearchError.setFont(h);
		btsure.setFont(h);
		lsearchError.setForeground(Color.red);
		btsure.setForeground(Color.blue);
		psearchError.add(lsearchError);
		psearchError.add(btsure);
		psearchError.add(lb);
		fsearchError.add(psearchError,"Center");
		lsearchError.setBounds(80,25,150,30);
		btsure.setBounds(180,60,90,30);
		lb.setBounds(0,0,300,140);
		btsure.addActionListener(this);
		fsearchError.setLocation(530,400);
		fsearchError.setSize(300,140);
		fsearchError.setVisible(true);
		fsearchError.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			fsearchError.dispose(); 
		}
	}
}

class SearchNo implements ActionListener{
	JFrame fsearchno;
	JPanel psearchno;
	JLabel lsearchno,lb;
	JButton btsure;
	void go(){
		Font h = new Font("楷体", Font.BOLD, 18);
		lb = new JLabel(new ImageIcon("2.jpg"));
		fsearchno = new JFrame("查询不成功");
		psearchno = new JPanel();
		psearchno.setLayout(null);
		lsearchno = new JLabel("该学号不存在!");
		btsure = new JButton("确 定");
		lsearchno.setFont(h);
		btsure.setFont(h);
		lsearchno.setForeground(Color.red);
		btsure.setForeground(Color.blue);
		psearchno.add(lsearchno);
		psearchno.add(btsure);
		psearchno.add(lb);
		fsearchno.add(psearchno,"Center");
		lsearchno.setBounds(80,25,150,30);
		btsure.setBounds(180,60,90,30);
		lb.setBounds(0,0,300,140);
		btsure.addActionListener(this);
		fsearchno.setLocation(530,400);
		fsearchno.setSize(300,140);
		fsearchno.setVisible(true);
		fsearchno.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			fsearchno.dispose(); 
		}
	}
}

class SearchResultFrame implements ActionListener{
	JFrame fsearchresult;
	JPanel psearchresult;
	JLabel lb;
	JLabel lbnumber,lbname,lbsex,lbage,lbresult,lbchinese,lbmaths,lbenglish,lbnumberresult,lbnameresult,lbsexresult,lbageresult,lbchineseresult,lbmathsresult,lbenglishresult;
	JButton btsure;
	void go(){
		Font h = new Font("楷体", Font.BOLD, 18);
		Font q = new Font("楷体", Font.BOLD, 22);
		lb = new JLabel(new ImageIcon("4.jpg"));
		fsearchresult = new JFrame("查询结果");
		psearchresult = new JPanel();
		psearchresult.setLayout(null);
		lbnumber = new JLabel("学号");
		lbname = new JLabel("姓名");
		lbsex = new JLabel("性别");
		lbage = new JLabel("年龄");
		lbresult = new JLabel("成绩");
		lbchinese = new JLabel("语文");
		lbmaths = new JLabel("数学");
		lbenglish = new JLabel("英语");
		lbnumberresult = new JLabel(SMS.student[SMS.m][0].toString());
		lbnameresult = new JLabel(SMS.student[SMS.m][1].toString());
		lbsexresult = new JLabel(SMS.student[SMS.m][2].toString());
		lbageresult = new JLabel(SMS.student[SMS.m][3].toString());
		lbchineseresult = new JLabel(SMS.student[SMS.m][4].toString());
		lbmathsresult = new JLabel(SMS.student[SMS.m][5].toString());
		lbenglishresult = new JLabel(SMS.student[SMS.m][6].toString());
		btsure = new JButton("确 定");
		lbnumber.setFont(h);
		lbname.setFont(h);
		lbsex.setFont(h);
		lbage.setFont(h);
		lbresult.setFont(q);
		lbchinese.setFont(h);
		lbmaths.setFont(h);
		lbenglish.setFont(h);
		lbnumberresult.setFont(h);
		lbnameresult.setFont(h);
		lbsexresult.setFont(h);
		lbageresult.setFont(h);
		lbchineseresult.setFont(h);
		lbmathsresult.setFont(h);
		lbenglishresult.setFont(h);
		lbnumber.setForeground(Color.blue);
		lbname.setForeground(Color.blue);
		lbsex.setForeground(Color.blue);
		lbage.setForeground(Color.blue);
		lbresult.setForeground(Color.red);
		lbchinese.setForeground(Color.red);
		lbmaths.setForeground(Color.red);
		lbenglish.setForeground(Color.red);
		lbnumberresult.setForeground(Color.blue);
		lbnameresult.setForeground(Color.blue);
		lbsexresult.setForeground(Color.blue);
		lbageresult.setForeground(Color.blue);
		lbchineseresult.setForeground(Color.red);
		lbmathsresult.setForeground(Color.red);
		lbenglishresult.setForeground(Color.red);
		btsure.setFont(h);
		btsure.setForeground(Color.blue);
		psearchresult.add(lbnumber);
		psearchresult.add(lbname);
		psearchresult.add(lbsex);
		psearchresult.add(lbage);
		psearchresult.add(lbresult);
		psearchresult.add(lbchinese);
		psearchresult.add(lbmaths);
		psearchresult.add(lbenglish);
		psearchresult.add(lbnumberresult);
		psearchresult.add(lbnameresult);
		psearchresult.add(lbsexresult);
		psearchresult.add(lbageresult);
		psearchresult.add(lbchineseresult);
		psearchresult.add(lbmathsresult);
		psearchresult.add(lbenglishresult);
		psearchresult.add(btsure);
		psearchresult.add(lb);
		fsearchresult.add(psearchresult,"Center");
		lbnumber.setBounds(25,30,40,25);
		lbname.setBounds(25,75,40,25);
		lbsex.setBounds(25,120,40,25);
		lbage.setBounds(25,165,40,25);
		lbresult.setBounds(180,30,80,25);
		lbchinese.setBounds(180,75,40,25);
		lbmaths.setBounds(180,120,40,25);
		lbenglish.setBounds(180,165,40,25);
		lbnumberresult.setBounds(80,30,80,25);
		lbnameresult.setBounds(80,75,60,25);
		lbsexresult.setBounds(80,120,40,25);
		lbageresult.setBounds(80,165,40,25);
		lbchineseresult.setBounds(235,75,40,25);
		lbmathsresult.setBounds(235,120,40,25);
		lbenglishresult.setBounds(235,165,40,25);
		lb.setBounds(0,0,330,300);
		btsure.setBounds(200,215,100,30);
		fsearchresult.setLocation(500,300);
		fsearchresult.setSize(330,300);
		fsearchresult.setVisible(true);
		fsearchresult.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		btsure.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			fsearchresult.dispose(); 
		}
	}
}

class TaxisChoiceFrame implements ActionListener{
	JFrame ftaxischoice;
	JPanel ptaxischoice;
	Choice ctaxischoice;
	JLabel ltaxischoice,lb;
	JButton btsure;
	void go(){
		Font h = new Font("楷体", Font.BOLD, 18);
		lb = new JLabel(new ImageIcon("3.jpg"));
		ftaxischoice = new JFrame("排序选择");
		ptaxischoice = new JPanel();
		ptaxischoice.setLayout(null);
		ltaxischoice = new JLabel("科目选择:");
		ctaxischoice = new Choice();
		ctaxischoice.addItem("语文");
		ctaxischoice.addItem("数学");
		ctaxischoice.addItem("英语");
		btsure = new JButton("确 定");
		ltaxischoice.setFont(h);
		ltaxischoice.setForeground(Color.yellow);
		btsure.setFont(h);
		btsure.setForeground(Color.blue);
		ptaxischoice.add(ctaxischoice);
		ptaxischoice.add(ltaxischoice);
		ptaxischoice.add(btsure);
		ptaxischoice.add(lb);
		ftaxischoice.add(ptaxischoice,"Center");
		ltaxischoice.setBounds(40,25,100,40);
		ctaxischoice.setBounds(130,34,150,40);
		btsure.setBounds(200,80,100,30);
		lb.setBounds(0,0,350,160);
		ftaxischoice.setLocation(500,300);
		ftaxischoice.setSize(350,160);
		ftaxischoice.setVisible(true);
		ftaxischoice.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		btsure.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e){
		if((String)e.getActionCommand()=="确 定"){
			try { 
				File f = new File("排序结果");
				if(f.exists()){
					f.delete();
				}
				BufferedWriter output = new BufferedWriter(new FileWriter("排序结果.txt"));
				if((String)ctaxischoice.getSelectedItem()=="语文"){
					SMS.g = 4;
				}
				if((String)ctaxischoice.getSelectedItem()=="数学"){
					SMS.g = 5;
				}
				if((String)ctaxischoice.getSelectedItem()=="英语"){
					SMS.g = 6;
				}
				for(int q=0;q<=SMS.i;q++){
					int w=1;
					if(SMS.student[q][0]!=SMS.temp){
						for(int t=0;t<=SMS.i;t++){
							if(SMS.student[t][0]!=SMS.temp && Integer.parseInt(SMS.student[t][SMS.g].toString())>Integer.parseInt(SMS.student[q][SMS.g].toString())){
								w++;
							}
						}
						SMS.student[q][7] = new StringBuffer(String.valueOf(w));
					}
				}
				output.write("名次|学号|姓名|性别|年龄|语文|数学|英语"+"\r\n");
				for(int c=1;c<=SMS.i+1;c++){
					for(int r=0;r<=SMS.i;r++){
						if(SMS.student[r][0]!=SMS.temp && Integer.parseInt(SMS.student[r][7].toString())==c){
							output.write(String.valueOf(c)+"|"+SMS.student[r][0].toString()+"|"+SMS.student[r][1].toString()+"|"+SMS.student[r][2].toString()+"|"+SMS.student[r][3].toString()+"|"+SMS.student[r][4].toString()+"|"+SMS.student[r][5].toString()+"|"+SMS.student[r][6].toString()+"\r\n");
						}
					}
				}
				output.close();
			}
			catch (Exception ev) {} 
			ftaxischoice.dispose(); 
			try 
			{  
				Runtime.getRuntime().exec("cmd.exe /c start 排序结果.txt"); 
			} 
			catch(Exception ev) 
			{ 
				ev.printStackTrace(); 
			} 
		}
	}
}

⌨️ 快捷键说明

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