如题,谢谢!

解决方案 »

  1.   

    答:设文本框对象为:jTextArea1,则:
    你不断地从文本文件中用:BufferedReader的readLine()读入一行line,然后用:
    jTextArea1.append(line+"\n");添加就行了。
      

  2.   

    4楼的那个while判断文件结束的条件貌似不适合这题。。
    如题:。(多行,并且存在空行)。。
      

  3.   


    package csdn;import java.io.File;
    import java.io.IOException;
    import java.io.RandomAccessFile;public class ColligationIO { 
    public static void main(String args[]) throws IOException { 
    RandomAccessFile rf = null;
    try {
    rf = new RandomAccessFile(new File("e:\\test.txt"), "r"); 
    long length = rf.length();//文件的长度
    String text = null;//每次读取的内容
    long textLength = 0;//已经读取的长度
    while (((text=rf.readLine())!=null)||(textLength!=length)) { 
    if(text!=null)textLength +=text.length();//每次读取一次增加已读取的长度!
    System.out.println(text);

    }finally {
    if(rf!=null)
    rf.close();
    }

    }
      

  4.   

    是的, while((str=br.readLine())!=null)表示程序遇到空行就结束了!
    7楼的好像很有道理,等会试试!