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

📄 xsmis.java

📁 适合学生信息管理系统适用于全国各大民办高校
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		
		dcj1.add(p41);
		dcj1.addWindowListener(new WindowAdapter()
		        {
			        public void windowClosing(WindowEvent e)
			        {
				      dcj1.setVisible(false);
			        }
		         }
		         );	
		mcj.addActionListener(this);
	     //帮助功能的实现如下
	     MenuItem m51=new MenuItem("帮助信息");
		 mhelp.add(m51);
		 
		 dhelp=new Dialog(f,"         帮助信息",true);
		 dhelp.setSize(250,250);
		 dhelp.setLocation(510,200);
		 
		 dhelp.setResizable(false);
         
        
         lst4=new List(20);
         lst4.setForeground(Color.magenta);
         lst4.add("         JAVA模拟学生信息管理系统");
         lst4.add("          袁渊   20024034");
         lst4.add("                由于所学的JAVA知识有限");
         lst4.add("              有很多的不足之处在所难免");
         lst4.add("             在以后学了数据库后再添加上.");
         lst4.add("             将会更加完美!!!");
        
         lst4.setBackground(Color.pink);
          dhelp.add(lst4);     
	     dhelp.addWindowListener(new WindowAdapter()
		        {
			        public void windowClosing(WindowEvent e)
			        {
				      dhelp.setVisible(false);
			        }
		         }
		         );	
		mhelp.addActionListener(this);
		//学生信息查询系统的功能实现如下
         MenuItem m61=new MenuItem("信息查询");
		 MenuItem m62=new MenuItem("退出系统");
		 mxsxx.add(m61);
		 mxsxx.add(m62);
		 
		 dxsxx=new Dialog(f,"                 信息查询",true);
		 dxsxx.setSize(350,250);
		 dxsxx.setLocation(510,200);
	     dxsxx.setLayout(new GridLayout(2,1));
		 dxsxx.setResizable(false);
		 lst5=new List(20);
		 l61=new Label("                 姓名");
		 l62=new Label("                 学号");
		 l63=new Label("填好学号和姓名,按'提交'就可以");
		 l64=new Label("自动完成学生信息的查询功能");
		 tf61=new TextField();
		 tf62=new TextField();
		
		 b64=new Button("打开");
	   	 b63=new Button("保存");
	     b61=new Button("提交");
		 b62=new Button("退出");
	     
	    b61.addActionListener(this);
		b62.addActionListener(this);
		b63.addActionListener(this);
		b64.addActionListener(this);
		
		dxsxx.add(lst5);
		p61=new Panel();
		//Panel p62=new Panel();
		p61.setLayout(new GridLayout(5,1));
		p61.setBackground(Color.pink);
		
		p61.add(l61);p61.add(tf61);
		p61.add(l62);p61.add(tf62);
		p61.add(b63);p61.add(b64);
		p61.add(b61);p61.add(b62);
		p61.add(l63);p61.add(l64);
		
		dxsxx.add(p61);
		dxsxx.addWindowListener(new WindowAdapter()
		        {
			        public void windowClosing(WindowEvent e)
			        {
				      dxsxx.setVisible(false);
			        }
		         }
		         );	
		mxsxx.addActionListener(this); 
		 
		
		mb.add(mxj);
		mb.add(mbj);
		mb.add(mkc	);
		mb.add(mcj);
		mb.add(mxsxx);
		mb.add(mhelp);
	}
	
	    public void open1()//////////自动设置"学籍"的记录数/////////
	    {
	    	//int row=0;
		    long len1;
		    String str1="";
		    String str2=""+'\n';
	    	try
	    	{
	    		File f11=new File("F:\\学籍.txt");
		        RandomAccessFile raf10=new RandomAccessFile(f11,"rw");
		        len1=raf10.length();
		        for(int ii=0;ii<len1;ii++)
	            {
	            	str1=""+(char)raf10.readByte();
			        if(str1.equals(str2))
			        row1++;
		        }
		        //row1++;
		    }
		    catch(IOException e1)
	     	{
	     		System.out.println(e1.getMessage());
	     	}
	    	
	    }
	    public void open2()//////////自动设置"班级"的记录数/////////
	    {
	    	//int row=0;
		    long len21;
		    String str21="";
		    String str22=""+'\n';
	    	try
	    	{
	    		File f1=new File("F:\\班级.txt");
		        RandomAccessFile raf20=new RandomAccessFile(f1,"rw");
		        len21=raf20.length();
		        for(int ii2=0;ii2<len21;ii2++)
	            {
	            	str21=""+(char)raf20.readByte();
			        if(str21.equals(str22))
			        row2++;
		        }
		        //row2++;
		        //tft1=new TextField(""+(++row));
		    }
		    catch(IOException e1)
	     	{
	     		System.out.println(e1.getMessage());
	     	}
	    	
	    }
	    
	    public void open3()//////////自动设置"选课"的记录数/////////
	    {
	    	long len31;
		    String str31="";
		    String str32=""+'\n';
	    	try
	    	{
	    		File f31=new File("F:\\选课.txt");
		        RandomAccessFile raf30=new RandomAccessFile(f31,"rw");
		        len31=raf30.length();
		        for(int ii3=0;ii3<len31;ii3++)
	            {
	            	str31=""+(char)raf30.readByte();
			        if(str31.equals(str32))
			        row3++;
		        }
		        //row3++;
		        
		    }
		    catch(IOException e1)
	     	{
	     		System.out.println(e1.getMessage());
	     	}
	    	
	    }
	    
	    public void open4()//////////自动设置"成绩"的记录数/////////
	    {
	    	//int row=0;
		    long len41;
		    String str41="";
		    String str42=""+'\n';
	    	try
	    	{
	    		File f41=new File("F:\\成绩.txt");
		        RandomAccessFile raf40=new RandomAccessFile(f41,"rw");
		        len41=raf40.length();
		        for(int ii4=0;ii4<len41;ii4++)
	            {
	            	str41=""+(char)raf40.readByte();
			        if(str41.equals(str42))
			        row4++;
		        }
		        //row4++;
		        //tft1=new TextField(""+(++row));
		    }
		    catch(IOException e1)
	     	{
	     		System.out.println(e1.getMessage());
	     	}
	    	
	    }
	    
	public void actionPerformed(ActionEvent e) 
	{
////////////////////////学籍管理的实现//////////////////////////////////////
		if(e.getActionCommand()=="新生入学")
		{
			lst0.removeAll();//在打开对话框之前移掉以前所有的选项,下面同功能
			dxj1.setVisible(true);
		}
		if(e.getActionCommand()=="退出系统")
		{
			System.exit(0);
		}
		if(e.getActionCommand()=="添加 ")
		{
			String str;
			str=tf3.getText()+"   ";
			str=str+tf1.getText()+"   ";
			if(cb1.getState())
			str=str+"   "+cb1.getLabel();
			if(cb2.getState())
			str=str+"   "+cb2.getLabel();
			str=str+"   "+tf4.getText()+"   "+tf5.getText()+"   "+tf6.getText();
			lst0.add(str);
			tft1.setText(""+(Integer.parseInt(tft1.getText())+1));
		}
		if (e.getActionCommand()=="打开 ")               //单击[打开]按钮时
		 {
		            fd0 = new FileDialog(f,"打开 ",FileDialog.LOAD);
		            fd0.setVisible(true);             //创建并显示打开文件对话框
		            if ((fd0.getDirectory()!=null) && (fd0.getFile()!=null))
		            {
		                try                          //以缓冲区方式读取文件内容
		                {
		                    file0 = new File(fd0.getDirectory(),fd0.getFile());
		                    FileReader fr = new FileReader(file0);
		                    BufferedReader br = new BufferedReader(fr);
		                    String aline;
		                    while ((aline=br.readLine()) != null)//按行读取文本
		                        lst0.add(aline+"\r");
		                    fr.close();
		                    br.close();
		                }
		                catch (IOException ioe)
		                {
		                    System.out.println(ioe);
		                }
		            }
          }
		if (e.getActionCommand()=="保存 ")
	    {                                    //单击[保存]按钮时
	            if ((e.getActionCommand()=="保存 ")&&(file0==null))  //单击[保存]按钮且文件对象为空时
	            {
	                fd0 = new FileDialog(f,"保存 ",FileDialog.SAVE);
	                 if (file0==null)
	                    fd0.setFile("学籍.txt");
	                else
	                    fd0.setFile(file0.getName());
	                fd0.setVisible(true);         //创建并显示保存文件对话框

	                if ((fd0.getDirectory()!=null) && (fd0.getFile()!=null))
	                {
	                    file0 = new File(fd0.getDirectory(),fd0.getFile());
	                    save0(file0);
	                }
				}
	            else
	             save0(file0);
	     }
	     if(e.getActionCommand()=="删除 ")
	     {
	     	String str;
	     	str=lst0.getSelectedItem();
	     	lst0.remove(str);
	     	tft1.setText(""+(Integer.parseInt(tft1.getText())-1));
	     }
	     if(e.getActionCommand()=="退出 ")
	     {
	     	dxj1.setVisible(false);
		 }
///////////////////////班级信息管理系统的实现/////////////////////////////////////////
        if(e.getActionCommand()=="班级信息加入")
		{
			lst1.removeAll();
			dbj1.setVisible(true);
		}
		if(e.getActionCommand()=="添加  ")
		{
			String str;
			str=tf21.getText()+"     "+tf22.getText()+"     "+tf23.getText();
			lst1.add(str);
			tft2.setText(""+(Integer.parseInt(tft2.getText())+1));
		}
		if (e.getActionCommand()=="打开  ")               //单击[打开]按钮时
		 {
		            fd1 = new FileDialog(f,"打开  ",FileDialog.LOAD);
		            fd1.setVisible(true);             //创建并显示打开文件对话框
		            if ((fd1.getDirectory()!=null) && (fd1.getFile()!=null))
		            {
		                try                          //以缓冲区方式读取文件内容
		                {
		                    file1 = new File(fd1.getDirectory(),fd1.getFile());
		                    FileReader fr = new FileReader(file1);
		                    BufferedReader br = new BufferedReader(fr);
		                    String aline;
		                    while ((aline=br.readLine()) != null)//按行读取文本
		                        lst1.add(aline+"\r");
		                    fr.close();
		                    br.close();
		                }
		                catch (IOException ioe)
		                {
		                    System.out.println(ioe);
		                }
		            }
          }
		if (e.getActionCommand()=="保存  ")
	    {                                    //单击[保存]按钮时
	            if ((e.getActionCommand()=="保存  ")&&(file1==null))  //单击[保存]按钮且文件对象为空时
	            {
	                fd1 = new FileDialog(f,"保存  ",FileDialog.SAVE);
	                 if (file1==null)
	                    fd1.setFile("班级.txt");
	                else
	                    fd1.setFile(file1.getName());
	                fd1.setVisible(true);         //创建并显示保存文件对话框

	                if ((fd1.getDirectory()!=null) && (fd1.getFile()!=null))
	                {
	                    file1 = new File(fd1.getDirectory(),fd1.getFile());
	                    save1(file1);
	                }
				}
	            else
	             save1(file1);
	     }
	     if(e.getActionCommand()=="删除  ")
	     {
	     	String str;
	     	str=lst1.getSelectedItem();
	     	lst1.remove(str);
	     	tft2.setText(""+(Integer.parseInt(tft2.getText())-1));
	     }
		if(e.getActionCommand()=="退出  ")
	     {
	     	dbj1.setVisible(false);
		 }
////////////////////////选课管理系统的实现////////////////////////////////////////
        if(e.getActionCommand()=="进入选课")
		{
			lst2.removeAll();
			dkc1.setVisible(true);
		}
		if(e.getActionCommand()=="添加   ")
		{
			String str;
			str=tf31.getText()+"     "+tf32.getText()+"     "+tf33.getText();
			lst2.add(str);
			tft3.setText(""+(Integer.parseInt(tft3.getText())+1));
		}
		if (e.getActionCommand()=="打开   ")               //单击[打开]按钮时
		 {
		            fd2 = new FileDialog(f,"打开   ",FileDialog.LOAD);

⌨️ 快捷键说明

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