这是一个 记事本功能,我只需要记事本的保存功能,我该如何修改? 那位大哥帮下我,,需要一个JAVA记事本小程序,里面就只需要一个保存和退出功能! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 需求能在详细一点么?记事本界面是GUI设计还是什么?需要背景不? DefaultEditorKit kit = new DefaultEditorKit();Document doc = jtextcomponent.getDocument();kit.write(new FileWriter(...), doc, 0, doc.getLength()); import javax.swing.*;class Benben extends JFrame{Benben(){this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.add(new JButton("保存"){addActionListener(this)});}public void ActionPerformed(Actionevent e){doSave();}void doSave(){ FileDialog fd =new FileDialog(mf,"saveFile",FileDialog.SAVE); fd.setVisible(true); String s= fd.getDirectory(); String fl=fd.getFile(); String filename=s+fl; String str =mf.jta.getText(); try{ FileWriter fw = new FileWriter(filename); fw.write(str); fw.close(); } catch(Exception e){} }} 请教个方法内常量的问题 用BoneCP连接池一秒钟入库只有5条?难道我写的程序真的这么差吗?有人能指点一下吗? 请高手给我指点一下我的这个计算器小代码中的button按钮为什么不能被监听 Java基础问题,求助 写了个小程序,运行时出现异常 一个简单的聊天程序,大家帮我挑挑毛病! 这个东东怎么解决? 关于环境变量的问题 请问在Java中String变量的最大长度是多少? 我想到上海工作,但不知上海的IT业行情如何?高分求解! 算法题。给出一推点的坐标,和入口点,结束点,求出最短路径 位图(即像素图)内的像素最大能放大到多大?
记事本界面是GUI设计还是什么?
需要背景不?
Document doc = jtextcomponent.getDocument();
kit.write(new FileWriter(...), doc, 0, doc.getLength());
class Benben extends JFrame{
Benben(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.add(new JButton("保存"){addActionListener(this)});
}
public void ActionPerformed(Actionevent e)
{
doSave();
}
void doSave(){
FileDialog fd =new FileDialog(mf,"saveFile",FileDialog.SAVE);
fd.setVisible(true);
String s= fd.getDirectory();
String fl=fd.getFile();
String filename=s+fl;
String str =mf.jta.getText();
try{
FileWriter fw = new FileWriter(filename);
fw.write(str);
fw.close();
}
catch(Exception e){}
}
}