【发布时间】:2012-04-28 01:44:43
【问题描述】:
我想用继承自 JFrame 图标的图标创建我自己的文件,我在 java 中设置它,我自己的文件使用 FileOutputStream 和 ObjectOutputStream
try {
ObjectOutputStream oos;
//I create own file with own extension in drive D:
FileOutputStream fos = new FileOutputStream("D:/myFile.ckl");
oos = new ObjectOutputStream(fos);
//Write Document in JTextPane to File
oos.writeObject(jTextPane.getStyledDocument());
oos.close();
fos.close();
} catch (Exception exp) {
JOptionPane.showMessageDialog(null, "" + exp.getStackTrace());
}
提前谢谢你
【问题讨论】: