give out your error message 

解决方案 »

  1.   

    用PrintWriter试试
    BufferedWriter bw=new BufferedWriter(out);
    -->
    PrintWriter pw=new PrintWriter(out);
    而且pw.println();可以直接输入一行文字
      

  2.   

    class OpenAction extends AbstractAction {
            public void actionPerformed(ActionEvent event) {
                openFile();
            }
            boolean openFile() {
                String s = null;
                StringBuffer strPool = new StringBuffer();
                Frame openFileFrame = new Frame("Open file");
                FileDialog fileDialog = new FileDialog(openFileFrame);
                fileDialog.setMode(FileDialog.LOAD);
                fileDialog.setFile("*.txt;*java;*html;*.class");
                fileDialog.show();
                String file = fileDialog.getFile();
                String directory = fileDialog.getDirectory();
                if(file != null) {
                    fileName = directory + file;
                    BufferedReader br;
                    try {
                        br = new BufferedReader(new FileReader(fileName));
                        s = br.readLine();
                        while(s != null) {
                            strPool.append(s + "\12");
                            s = br.readLine();
                        }
                        br.close();
                        textArea.setText(strPool.toString());
                    } catch(IOException e) {
                        return false;
                    }
                    return true;
                }
                else {
                    return false;
                }
            }
        }
    这是我写的一个open类,它可以打开*.java,*.txt,*.html,*.class文件,不过*.class的是不可阅读的,照此你可写出保存的!!!