快!快!快!I/O give out your error message 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用PrintWriter试试BufferedWriter bw=new BufferedWriter(out);-->PrintWriter pw=new PrintWriter(out);而且pw.println();可以直接输入一行文字 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的是不可阅读的,照此你可写出保存的!!! applet如何运行在网页中 J B O S S禁止浏览目录的问题有人知道吗? Set存值特点? 新人 菜鸟问题 如何往列表框中添加按钮? 请高手指点,我是新手 incompatible types 求救 求助读文件数据 大家来讨论一下java中得static得使用心得 为什么我的文件写不进去??请各位帮我看看 在eclipse中使用tomcat插件的问题,欢迎讨论。 jcreator下的jdk怎么配置?
BufferedWriter bw=new BufferedWriter(out);
-->
PrintWriter pw=new PrintWriter(out);
而且pw.println();可以直接输入一行文字
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的是不可阅读的,照此你可写出保存的!!!