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

📄 xsmis.java

📁 适合学生信息管理系统适用于全国各大民办高校
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		            fd2.setVisible(true);             //创建并显示打开文件对话框
		            if ((fd2.getDirectory()!=null) && (fd2.getFile()!=null))
		            {
		                try                          //以缓冲区方式读取文件内容
		                {
		                    file2 = new File(fd2.getDirectory(),fd2.getFile());
		                    FileReader fr = new FileReader(file2);
		                    BufferedReader br = new BufferedReader(fr);
		                    String aline;
		                    while ((aline=br.readLine()) != null)//按行读取文本
		                        lst2.add(aline+"\r");
		                    fr.close();
		                    br.close();
		                }
		                catch (IOException ioe)
		                {
		                    System.out.println(ioe);
		                }
		            }
          }
		if (e.getActionCommand()=="保存   ")
	    {                                    //单击[保存]按钮时
	            if ((e.getActionCommand()=="保存   ")&&(file2==null))  //单击[保存]按钮且文件对象为空时
	            {
	                fd2 = new FileDialog(f,"保存   ",FileDialog.SAVE);
	                 if (file2==null)
	                    fd2.setFile("选课.txt");
	                else
	                    fd2.setFile(file2.getName());
	                fd2.setVisible(true);         //创建并显示保存文件对话框

	                if ((fd2.getDirectory()!=null) && (fd2.getFile()!=null))
	                {
	                    file2 = new File(fd2.getDirectory(),fd2.getFile());
	                    save2(file2);
	                }
				}
	            else
	             save2(file2);
	     }
	     if(e.getActionCommand()=="删除   ")
	     {
	     	String str;
	     	str=lst2.getSelectedItem();
	     	lst2.remove(str);
	     	tft3.setText(""+(Integer.parseInt(tft3.getText())-1));
	     }
		 if(e.getActionCommand()=="退出   ")
	     {
	     	dkc1.setVisible(false);
		 }
///////////////////////////成绩管理系统的实现/////////////////////////////////////
        if(e.getActionCommand()=="成绩录入")
		{
			lst3.removeAll();
			dcj1.setVisible(true);
		}
		if(e.getActionCommand()=="添加    ")
		{
			String str;
			str=tf41.getText()+"     "+tf42.getText()+"     "+tf43.getText();
			lst3.add(str);
			tft4.setText(""+(Integer.parseInt(tft4.getText())+1));
		}
		if (e.getActionCommand()=="打开    ")               //单击[打开]按钮时
		 {
		            fd3 = new FileDialog(f,"打开    ",FileDialog.LOAD);
		            fd3.setVisible(true);             //创建并显示打开文件对话框
		            if ((fd3.getDirectory()!=null) && (fd3.getFile()!=null))
		            {
		                try                          //以缓冲区方式读取文件内容
		                {
		                    file3 = new File(fd3.getDirectory(),fd3.getFile());
		                    FileReader fr = new FileReader(file3);
		                    BufferedReader br = new BufferedReader(fr);
		                    String aline;
		                    while ((aline=br.readLine()) != null)//按行读取文本
		                        lst3.add(aline+"\r");
		                    fr.close();
		                    br.close();
		                }
		                catch (IOException ioe)
		                {
		                    System.out.println(ioe);
		                }
		            }
          }
		if (e.getActionCommand()=="保存    ")
	    {                                    //单击[保存]按钮时
	            if ((e.getActionCommand()=="保存    ")&&(file3==null))  //单击[保存]按钮且文件对象为空时
	            {
	                fd3 = new FileDialog(f,"保存    ",FileDialog.SAVE);
	                 if (file3==null)
	                    fd3.setFile("成绩.txt");
	                else
	                    fd3.setFile(file3.getName());
	                fd3.setVisible(true);         //创建并显示保存文件对话框

	                if ((fd3.getDirectory()!=null) && (fd3.getFile()!=null))
	                {
	                    file3 = new File(fd3.getDirectory(),fd3.getFile());
	                    save3(file3);
	                }
				}
	            else
	             save3(file3);
	     }
	     if(e.getActionCommand()=="删除    ")
	     {
	     	String str;
	     	str=lst3.getSelectedItem();
	     	lst3.remove(str);
	     	tft4.setText(""+(Integer.parseInt(tft4.getText())-1));
	     }
		if(e.getActionCommand()=="退出    ")
	     {
	     	dcj1.setVisible(false);
		 }
////////////////////////////帮助信息的实现///////////////////////////////////////
        if(e.getActionCommand()=="帮助信息")
		{
			dhelp.setVisible(true);
		}
		
///////////////////////////学生信息查询系统的实现///////////////////////////////////////////////
       if(e.getActionCommand()=="信息查询")
		{
			lst5.removeAll();
			dxsxx.setVisible(true);
		}
		if (e.getActionCommand()=="打开")               //单击[打开]按钮时
		 {
		            fd6 = new FileDialog(f,"打开",FileDialog.LOAD);
		            fd6.setVisible(true);             //创建并显示打开文件对话框
		            if ((fd6.getDirectory()!=null) && (fd6.getFile()!=null))
		            {
		                try                          //以缓冲区方式读取文件内容
		                {
		                    file6 = new File(fd6.getDirectory(),fd6.getFile());
		                    FileReader fr = new FileReader(file6);
		                    BufferedReader br = new BufferedReader(fr);
		                    String aline;
		                    while ((aline=br.readLine()) != null)//按行读取文本
		                        lst5.add(aline+"\r");
		                    fr.close();
		                    br.close();
		                }
		                catch (IOException ioe)
		                {
		                    System.out.println(ioe);
		                }
		            }
          }
		if (e.getActionCommand()=="保存")
	    {                                    //单击[保存]按钮时
	            if ((e.getActionCommand()=="保存")&&(file6==null))  //单击[保存]按钮且文件对象为空时
	            {
	                fd6 = new FileDialog(f,"保存",FileDialog.SAVE);
	                 if (file6==null)
	                    fd6.setFile("*.txt");
	                else
	                    fd6.setFile(file6.getName());
	                fd6.setVisible(true);         //创建并显示保存文件对话框

	                if ((fd6.getDirectory()!=null) && (fd6.getFile()!=null))
	                {
	                    file6 = new File(fd6.getDirectory(),fd6.getFile());
	                    save6(file6);
	                }
				}
	            else
	             save6(file6);
	     }
	     if(e.getActionCommand()=="提交") 
	     {
	     	String str00=tf61.getText();
	     	lst5.add(str00+"'s information,As follows:");
	     	String str0=tf62.getText();
	     	int len=8;
	     	try
	     	{
	     		RandomAccessFile raf1=new RandomAccessFile("F:\\学籍.txt","rw");
	     		String str1="",str2="";
		        for(int i=0;i<Integer.parseInt(tft1.getText());i++)
		        {
		        	str1=raf1.readLine();
			        str2=str1.substring(0,len);
			        if(str0.equals(str2))
		            lst5.add(str1);
		        }	    
	     	}
	     	catch(IOException ee)
	     	{
	     		System.out.println(ee.getMessage());
	     	}
	     	
	     	try
	     	{
	     		RandomAccessFile raf21=new RandomAccessFile("F:\\班级.txt","rw");
	     		String str21="",str22="";
		        for(int i1=0;i1<Integer.parseInt(tft2.getText());i1++)
		        {
		        	str21=raf21.readLine();
			        str22=str21.substring(0,len);
			        if(str0.equals(str22))
		            lst5.add(str21);
		        }	    
	     	}
	     	catch(IOException ee)
	     	{
	     		System.out.println(ee.getMessage());
	     	}
	     	
	     	try
	     	{
	     		RandomAccessFile raf31=new RandomAccessFile("F:\\选课.txt","rw");
	     		String str31="",str32="";
		        for(int i2=0;i2<Integer.parseInt(tft3.getText());i2++)
		        {
		        	str31=raf31.readLine();
			        str32=str31.substring(0,len);
			        if(str0.equals(str32))
		            lst5.add(str31);
		        }	    
	     	}
	     	catch(IOException ee)
	     	{
	     		System.out.println(ee.getMessage());
	     	}
	     	
	     	try
	     	{
	     		RandomAccessFile raf41=new RandomAccessFile("F:\\成绩.txt","rw");
	     		String str41="",str42="";
		        for(int i3=0;i3<Integer.parseInt(tft4.getText());i3++)
		        {
		        	str41=raf41.readLine();
			        str42=str41.substring(0,len);
			        if(str0.equals(str42))
		            lst5.add(str41);
		        }	    
	     	}
	     	catch(IOException ee)
	     	{
	     		System.out.println(ee.getMessage());
	     	}
	     
	     }
	     
		if(e.getActionCommand()=="退出")
		{
			dxsxx.setVisible(false);
		}
	 }
//////////////////////各个系统中实现保存功能中的小程序模块的实现/////////////////////////////////    
      public void save0(File file0)
	  {

	        try                            //将文本区内容写入字符输出流
	        {
				int iq=0;
				FileWriter fw = new FileWriter(file0);
				for(iq=0;iq<lst0.getItemCount();iq++)
				{
					   lst0.select(iq);
	                   fw.write(lst0.getSelectedItem()+"\r\n");
	            }
	            fw.close();
	            
	        }
	        catch (IOException ioe)
	        {
	            System.out.println(ioe);
	        }
	    }
	    
	    public void save1(File file1)
	    {

	        try                            //将文本区内容写入字符输出流
	        {
				int iw=0;
				FileWriter fw = new FileWriter(file1);
				for(iw=0;iw<lst1.getItemCount();iw++)
				{
					   lst1.select(iw);
	                   fw.write(lst1.getSelectedItem()+"\r\n");
	            }
	            fw.close();
	            
	        }
	        catch (IOException ioe)
	        {
	            System.out.println(ioe);
	        }
	    }
	    
	    public void save2(File file2)
	    {

	        try                            //将文本区内容写入字符输出流
	        {
				int ie=0;
				FileWriter fw = new FileWriter(file2);
				for(ie=0;ie<lst2.getItemCount();ie++)
				{
					   lst2.select(ie);
	                   fw.write(lst2.getSelectedItem()+"\r\n");
	            }
	            fw.close();
	            
	        }
	        catch (IOException ioe)
	        {
	            System.out.println(ioe);
	        }
	     }
	    
	    public void save3(File file3)
	    {

	        try                            //将文本区内容写入字符输出流
	        {
				int ir=0;
				FileWriter fw = new FileWriter(file3);
				for(ir=0;ir<lst3.getItemCount();ir++)
				{
					   lst3.select(ir);
	                   fw.write(lst3.getSelectedItem()+"\r\n");
	            }
	            fw.close();
	            
	        }
	        catch (IOException ioe)
	        {
	            System.out.println(ioe);
	        }
	     }

	     public void save6(File file6)
	     {

	        try                            //将文本区内容写入字符输出流
	        {
				int it=0;
				FileWriter fw = new FileWriter(file6);
				for(it=0;it<lst5.getItemCount();it++)
				{
					   lst5.select(it);
	                   fw.write(lst5.getSelectedItem()+"\r\n");
	            }
	            fw.close();
	            
	        }
	        catch (IOException ioe)
	        {
	            System.out.println(ioe);
	        }
	    }
	    
	
				
			
	public static void main(String[] args) 
	{
		Xsmis mis=new Xsmis();
		mis.display();
	}
}

⌨️ 快捷键说明

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