java云笔记代码 云笔记api( 三 )


}
else
{
JOptionPane.showMessageDialog(jf, "查找完毕!", "提示", 0, ic);
jf.dispose();
}
}
else if("全部替换".equals(comm))
{
String temp=jta.getText();
temp=temp.replaceAll(jtf.getText(), jt.getText());
jta.setText(temp);
}
}
public String read()
{
String temp="";
try
{
FileInputStream fis = new FileInputStream(f.getAbsolutePath());
byte[] b=new byte[1024];
while(true)
{
int num=fis.read(b);
if(num==-1)
break;
temp=temp+new String(b,0,num);
}
fis.close();
}
catch (Exception e1)
{
e1.printStackTrace();
}
return temp;
}
public void write()
{
try
{
FileOutputStream fos=new FileOutputStream(f);
fos.write(jta.getText().getBytes());
fos.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void newNew()
{
frame.dispose();
new MyNotepad();
flag=true;
}
public MyNotepad()
{
JMenuBar jmb=new JMenuBar();
String[] menuLab={"文件","编辑","帮助"};
String[][] menuItemLab={{"新建","打开","保存","另存","退出"},
{"撤销","剪切","复制","粘贴","删除","全选","查找","替换"},
{"版本"}};
for(int i=0;imenuLab.length;i++)
{
JMenu menu=new JMenu(menuLab[i]);
jmb.add(menu);
for(int j=0;jmenuItemLab[i].length;j++)
{
JMenuItem jmi=new JMenuItem(menuItemLab[i][j]);
menu.add(jmi);
jmi.addActionListener(this);
}
}
frame.setJMenuBar(jmb);
jta.setLineWrap(true);//自动换行
JScrollPane jsp=new JScrollPane(jta);//滚动窗口面板
frame.add(jsp);
jb.addActionListener(this);
jbt.addActionListener(this);
jba.addActionListener(this);
frame.setLocation(200,50);
frame.setSize(620,660);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args)
{
new MyNotepad();
}
}
java云笔记代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于云笔记api、java云笔记代码的信息别忘了在本站进行查找喔 。

推荐阅读