} public void Edit_replace_actionPerformed(ActionEvent e){ //替换 int cu=this.text.getCaretPosition(); int end=this.text.getText().length(); ReplaceDlg rd=new ReplaceDlg(frame,"替换",true); rd.show(); this.replaceStr(rd.findStr().trim(),rd.replaceStr().trim(),cu,end); } public void Edit_selectall_actionPerformed(ActionEvent e){ //全选 this.text.setSelectionStart(0); this.text.setSelectionEnd(this.text.getText().length()); } public void Edit_timedate_actionPerformed(ActionEvent e){ //时间日期 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); this.text.append("/r/n当前时间:"+sdf.format(new Date())); } ///////////// Format////////////////////////////////////// public void Format_Word_actionPerformed(ActionEvent e){ //自动换行 if(!this.text.getLineWrap()){ this.text.setLineWrap(true); } else{ this.text.setLineWrap(false);
} } public void Format_font_actionPerformed(ActionEvent e){ //字体"常规","斜体","粗体","粗斜体" Font cur=this.text.getFont(); int type=Font.BOLD; FontSet fs=new FontSet(frame,"字体设置",true); fs.show(); if(fs.flag){ switch(fs.font2()){ case 0:type=Font.PLAIN;break; case 1:type=Font.99vALIC;break; case 2:type=Font.BOLD; break; case 3:type=Font.ROMAN_BASELINE;break; default:type=Font.PLAIN;break; } Font f=new Font(fs.font1(),type,16); this.text.setFont(f); }else{ this.text.setFont(cur); } } public void Format_color_actionPerformed(ActionEvent e){ // 颜色 Color current=this.text.getForeground(); this.jColor.setColor(current); this.text.setForeground( this.jColor.showDialog(text,"选择颜色",current));
} //////////////////// Help ///////////////////////////////////// public void Help_about_actionPerformed(ActionEvent e){ //关于作者 new AboutDlg(); } //////////////////////////////////////////////////////// public void pop_undo_actionPerformed(ActionEvent e){ //Pop undo this.undo(); } public void pop_cut_actionPerformed(ActionEvent e){ //pop cut this.cut(); } public void pop_copy_acionPerformed(ActionEvent e){ //pop copy this.copy(); } public void pop_paste_actionPerformed(ActionEvent e){ //pop paste this.paste(); } public void pop_delete_actionPerformed(ActionEvent e){ //pop delete this.delete(); }
/************************************************************ ///////////////////////////////////////////////////////////// ////////////// coustm function /////////////////////////////// ///////////////////////////////////////////////////////////// ************************************************************/