for(int j=0;j if(findstring[j].indexOf(jt1.getText())!=-1){ findpersion=j; break; } } System.out.println(number); //number=5 if(findpersion!=-1){ sfind=findstring[ findpersion].toString(); sstr=sfind.split(\ jt2.setText(sstr[0]); jt3.setText(sstr[1]); jt4.setText(sstr[2]); jt5.setText(sstr[3]); jt6.setText(sstr[4]); jt7.setText(sstr[5]); } else{ JOptionPane.showMessageDialog(null, \查无此学生\提示\ JOptionPane.INFORMATION_MESSAGE); } } } ); jb2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(!jt1.getText().trim().equals(\ System.out.println(\ filefindd(); } else{ JOptionPane.showMessageDialog(null,\请输入需要查询学生的学号\ \温馨提示\ } } public void filefindd() { byte a1[]=new byte[1000]; int i; int findpersion=-1; String s2 =new String(); s2=jt2.getText()+\\ \\ String str = null; try{ FileInputStream fis=new FileInputStream(\ i=fis.read(a1,0,1000); try{ str=new String(a1,0,i); } catch(Exception ee){ System.out.println(\编码没有被发现\ } fis.close(); } catch(FileNotFoundException e){ System.out.println(\ } catch(IOException e){ e.printStackTrace(); } System.out.println(s2); String[] findstring=new String[number]; String string ; findstring=str.split(\ int no = 0; for(int j=0;j if(findstring[j].indexOf(jt1.getText())!=-1){ findstring[j]= s2; no=j; } } string =findstring[0]; for(int j=1;j string =string+\ } System.out.println(\ System.out.println(number); string=string+\ a1=string.getBytes(); try{ FileOutputStream fos=new FileOutputStream(\ fos.write(a1); JOptionPane.showMessageDialog(null, \信息修改成功\ \提示\ fos.close(); } catch(IOException e1){ e1.printStackTrace(); } } }); jt1=new JTextField(30); jt2=new JTextField(30); jt3=new JTextField(30); jt4=new JTextField(30); jt5=new JTextField(30); jt6=new JTextField(30); jt7=new JTextField(30); jl1=new JLabel(\输入要改的学生学号\ jl2=new JLabel(\修改学生信息\ jl2.setFont(new Font(\ jl3=new JLabel(\查询结果&请修改\ jl4=new JLabel(\学号\ jl5=new JLabel(\姓名\ jl6=new JLabel(\性别\ jl7=new JLabel(\专业\ jl8=new JLabel(\班级\ jl9=new JLabel(\身份证号\ jl2.setBounds( 200,20,300,30 ); jt1.setBounds( 250,80,80,25 ); jt2.setBounds( 10, 160,80,25 ); jt3.setBounds( 100,160,80,25 ); jt4.setBounds( 195,160,40,25 ); jt5.setBounds( 245,160,125,25 ); jt6.setBounds( 380,160,80,25 ); jt7.setBounds( 470,160,130,25 ); jb1.setBounds( 380,80,80,25 ); jb2.setBounds( 250, 300,80,60 ); jl1.setBounds( 100,80,160,25 ); jl3.setBounds( 240,120,200,25 ); jl4.setBounds( 40,200,80,25 ); jl5.setBounds( 120,200,80,25 ); jl6.setBounds( 200,200,80,25 ); jl7.setBounds( 280,200,80,25 ); jl8.setBounds( 400,200,80,25 ); jl9.setBounds( 495,200,80,25 ); j3.add(jb1); j3.add(jb2); j3.add(jt1); j3.add(jt2); j3.add(jt3); j3.add(jt4); j3.add(jt5); j3.add(jt6); j3.add(jt7); j3.add(jl1); j3.add(jl2); j3.add(jl3); j3.add(jl4); j3.add(jl5); j3.add(jl6); j3.add(jl7); j3.add(jl8); j3.add(jl9); // j3.add(jb2); this.add(j1); this.add(j2); this.add(j3); this.add(j4); this.setVisible(true); this.setSize(700,450); j1.setBackground(Color.RED); j1.setBounds(0, 0, 80, 450); j2.setBackground(Color.blue); j2.setBounds(80, 0, 620, 450); j3.setBackground(Color.green); j3.setBounds(80, 0, 620, 450); j3.setVisible(false); j4.setBackground(Color.cyan); j4.setBounds(80, 0, 620, 450); j4.setVisible(false); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { j2.setVisible(true); } }); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { j2.setVisible(false);