需求分析:

  1. 获得文本名称
  2. 实现尾部追加功能
  3. 实现覆盖式添加数据
  4. 删除数据
  5. 获取光标位置
  6. 在特定光标位置处添加数据
  7. 查找特定字符串在主串中第一次出现的位置
  8. 统计文本文件内出现的数字,汉字,英文字母,特殊字符的个数,及总的字符个数

    开发环境:

    windows7 + Eclipse luna + WindowsBuilder插件

代码实现:

  1. import java.awt.EventQueue;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import java.io.BufferedReader;
  5. import java.io.BufferedWriter;
  6. import java.io.File;
  7. import java.io.FileOutputStream;
  8. import java.io.FileReader;
  9. import java.io.IOException;
  10. import java.io.OutputStreamWriter;
  11. import javax.swing.JButton;
  12. import javax.swing.JFrame;
  13. import javax.swing.JLabel;
  14. import javax.swing.JPanel;
  15. import javax.swing.JTextArea;
  16. import javax.swing.border.EmptyBorder;
  17. import javax.swing.event.CaretEvent;
  18. import javax.swing.event.CaretListener;
  19. public class Test extends JFrame {
  20. private JPanel contentPane;
  21. private static File file = null;
  22. static int CursorPosition=-1;
  23. /**
  24. * Launch the application.
  25. */
  26. public static void main(String[] args) {
  27. EventQueue.invokeLater(new Runnable() {
  28. public void run() {
  29. try {
  30. Test frame = new Test();
  31. frame.setVisible(true);
  32. } catch (Exception e) {
  33. e.printStackTrace();
  34. }
  35. }
  36. });
  37. }
  38. /**
  39. * Create the frame.
  40. */
  41. public Test() {
  42. file = new File("F://test.txt");
  43. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  44. setBounds(100, 100, 720, 480);
  45. contentPane = new JPanel();
  46. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  47. setContentPane(contentPane);
  48. contentPane.setLayout(null);
  49. JTextArea taShow = new JTextArea();
  50. taShow.setLineWrap(true);
  51. taShow.setBounds(21, 41, 400, 359);
  52. JLabel label = new JLabel("\u6587\u672C\u9884\u89C8\u533A\uFF1A");
  53. label.setBounds(21, 16, 89, 15);
  54. contentPane.add(label);
  55. JTextArea taEdit = new JTextArea();
  56. taEdit.setLineWrap(true);
  57. taEdit.setBounds(449, 41, 233, 131);
  58. contentPane.add(taEdit);
  59. taShow.addCaretListener(new CaretListener() {
  60. @Override
  61. public void caretUpdate(CaretEvent e) {
  62. // TODO Auto-generated method stub
  63. StringBuffer sb = new StringBuffer();
  64. String length = "";
  65. String fileTitle;
  66. String fileContent;
  67. try {
  68. BufferedReader reader = new BufferedReader(new FileReader(
  69. "F://test.txt"));
  70. while ((length = reader.readLine()) != null) {
  71. sb.append(length);
  72. }
  73. fileContent = sb.toString();
  74. taShow.setText("您打开的文件的内容是:" + fileContent);
  75. CursorPosition = e.getDot();
  76. } catch (Exception e1) {
  77. // TODO Auto-generated catch block
  78. e1.printStackTrace();
  79. }
  80. }
  81. });
  82. contentPane.add(taShow);
  83. JButton btnGetName = new JButton("\u6587\u6863\u540D\u79F0");
  84. btnGetName.setBounds(449, 211, 93, 23);
  85. btnGetName.addActionListener(new ActionListener() {
  86. @Override
  87. public void actionPerformed(ActionEvent e) {
  88. // TODO Auto-generated method stub
  89. StringBuffer sb = new StringBuffer();
  90. String length = "";
  91. String fileTitle;
  92. String fileContent;
  93. try {
  94. BufferedReader reader = new BufferedReader(new FileReader(
  95. "F://test.txt"));
  96. while ((length = reader.readLine()) != null) {
  97. sb.append(length);
  98. }
  99. fileContent = sb.toString();
  100. fileTitle = file.getName().toString();
  101. taEdit.setText("您打开的文件的名称是:" + fileTitle);
  102. taShow.setText("您打开的文件的内容是:" + fileContent);
  103. } catch (Exception e1) {
  104. // TODO Auto-generated catch block
  105. e1.printStackTrace();
  106. }
  107. }
  108. });
  109. contentPane.add(btnGetName);
  110. JButton btnAppend = new JButton("\u8FFD\u52A0");
  111. btnAppend.setBounds(449, 261, 93, 23);
  112. btnAppend.addActionListener(new ActionListener() {
  113. @Override
  114. public void actionPerformed(ActionEvent e) {
  115. // TODO Auto-generated method stub
  116. String temp = taEdit.getText().toString();
  117. method1("F://test.txt", temp);
  118. StringBuffer sb = new StringBuffer();
  119. String length = "";
  120. String fileTitle;
  121. String fileContent;
  122. try {
  123. BufferedReader reader = new BufferedReader(new FileReader(
  124. "F://test.txt"));
  125. while ((length = reader.readLine()) != null) {
  126. sb.append(length);
  127. }
  128. fileContent = sb.toString();
  129. fileTitle = file.getName().toString();
  130. taEdit.setText("您打开的文件的名称是:" + fileTitle);
  131. taShow.setText("您打开的文件的内容是:" + fileContent);
  132. } catch (Exception e1) {
  133. // TODO Auto-generated catch block
  134. e1.printStackTrace();
  135. }
  136. }
  137. });
  138. contentPane.add(btnAppend);
  139. JButton btnOverride = new JButton("\u8986\u76D6");
  140. btnOverride.addActionListener(new ActionListener() {
  141. @Override
  142. public void actionPerformed(ActionEvent e) {
  143. // TODO Auto-generated method stub
  144. BufferedWriter out = null;
  145. try {
  146. out = new BufferedWriter(new OutputStreamWriter(
  147. new FileOutputStream(file)));
  148. out.write(taEdit.getText().toString());
  149. } catch (Exception ex) {
  150. ex.printStackTrace();
  151. } finally {
  152. try {
  153. if (out != null) {
  154. out.close();
  155. }
  156. } catch (IOException le) {
  157. le.printStackTrace();
  158. }
  159. }
  160. StringBuffer sb = new StringBuffer();
  161. String length = "";
  162. String fileTitle;
  163. String fileContent;
  164. try {
  165. BufferedReader reader = new BufferedReader(new FileReader(
  166. "F://test.txt"));
  167. while ((length = reader.readLine()) != null) {
  168. sb.append(length);
  169. }
  170. fileContent = sb.toString();
  171. fileTitle = file.getName().toString();
  172. taEdit.setText("您打开的文件的名称是:" + fileTitle);
  173. taShow.setText("您打开的文件的内容是:" + fileContent);
  174. } catch (Exception e1) {
  175. // TODO Auto-generated catch block
  176. e1.printStackTrace();
  177. }
  178. }
  179. });
  180. btnOverride.setBounds(449, 308, 93, 23);
  181. contentPane.add(btnOverride);
  182. JButton btnSearch = new JButton("\u67E5\u627E");
  183. btnSearch.setBounds(449, 357, 93, 23);
  184. btnSearch.addActionListener(new ActionListener() {
  185. @Override
  186. public void actionPerformed(ActionEvent e) {
  187. // TODO Auto-generated method stub
  188. StringBuffer sb = new StringBuffer();
  189. String length = "";
  190. String fileTitle;
  191. String fileContent;
  192. try {
  193. BufferedReader reader = new BufferedReader(new FileReader(
  194. "F://test.txt"));
  195. while ((length = reader.readLine()) != null) {
  196. sb.append(length);
  197. }
  198. fileContent = sb.toString();
  199. taShow.setText("您打开的文件的内容是:" + fileContent);
  200. String p = taEdit.getText().toString().trim();
  201. taShow.setText(fileContent+"\n\n"+"您查找的字符串第一次出现的位置是:"+fileContent.indexOf(p));
  202. } catch (Exception e1) {
  203. // TODO Auto-generated catch block
  204. e1.printStackTrace();
  205. }
  206. }
  207. });
  208. contentPane.add(btnSearch);
  209. JButton btnPosition = new JButton("\u5149\u6807\u4F4D\u7F6E");
  210. btnPosition.setBounds(589, 211, 93, 23);
  211. btnPosition.enable(false);
  212. contentPane.add(btnPosition);
  213. JButton btnInsert = new JButton("\u5B9A\u70B9\u63D2\u5165");
  214. btnInsert.setBounds(589, 261, 93, 23);
  215. btnInsert.addActionListener(new ActionListener(){
  216. @Override
  217. public void actionPerformed(ActionEvent e) {
  218. // TODO Auto-generated method stub
  219. StringBuffer sb = new StringBuffer();
  220. String length = "";
  221. String fileTitle;
  222. String fileContent;
  223. try {
  224. BufferedReader reader = new BufferedReader(new FileReader(
  225. "F://test.txt"));
  226. while ((length = reader.readLine()) != null) {
  227. sb.append(length);
  228. }
  229. String temp=taEdit.getText().toString();
  230. sb.insert(CursorPosition, temp);
  231. method1("F://test.txt", sb.toString());
  232. taShow.setText(sb.toString());
  233. taEdit.setText("定点的数据插入成功执行!");
  234. }catch(Exception ev){
  235. ev.printStackTrace();
  236. }
  237. }
  238. });
  239. contentPane.add(btnInsert);
  240. JButton btnDelete = new JButton("\u5220\u9664");
  241. btnDelete.setBounds(589, 308, 93, 23);
  242. btnDelete.addActionListener(new ActionListener() {
  243. @Override
  244. public void actionPerformed(ActionEvent e) {
  245. // TODO Auto-generated method stub
  246. BufferedWriter out = null;
  247. try {
  248. out = new BufferedWriter(new OutputStreamWriter(
  249. new FileOutputStream(file)));
  250. out.write("");
  251. taShow.setText("删除操作已完成,请到相应路径下查看!");
  252. } catch (Exception ex) {
  253. ex.printStackTrace();
  254. } finally {
  255. try {
  256. if (out != null) {
  257. out.close();
  258. }
  259. } catch (IOException le) {
  260. le.printStackTrace();
  261. }
  262. }
  263. }
  264. });
  265. contentPane.add(btnDelete);
  266. JButton btnTotal = new JButton("\u7EDF\u8BA1");
  267. btnTotal.setBounds(589, 357, 93, 23);
  268. btnTotal.addActionListener(new ActionListener() {
  269. @Override
  270. public void actionPerformed(ActionEvent e) {
  271. // TODO Auto-generated method stub
  272. StringBuffer sb = new StringBuffer();
  273. String length = "";
  274. String fileTitle;
  275. String fileContent;
  276. try {
  277. BufferedReader reader = new BufferedReader(new FileReader(
  278. "F://test.txt"));
  279. while ((length = reader.readLine()) != null) {
  280. sb.append(length);
  281. }
  282. fileContent = sb.toString();
  283. new Total().find(fileContent);
  284. String flag = "数据信息统计结果如下:" + "\n" + "汉字数目:";
  285. flag += new Total().chineseCount;
  286. flag += "\n英文字母个数:";
  287. flag += new Total().englishCount;
  288. flag += "\n特殊字符个数:";
  289. flag += new Total().numberCount;
  290. flag += "\n总的字符个数为:"
  291. + (new Total().chineseCount
  292. + new Total().englishCount + new Total().numberCount);
  293. taShow.setText(flag);
  294. new Total().chineseCount = 0;
  295. new Total().englishCount = 0;
  296. new Total().numberCount = 0;
  297. } catch (Exception ec) {
  298. ec.printStackTrace();
  299. }
  300. }
  301. });
  302. contentPane.add(btnTotal);
  303. JLabel label_1 = new JLabel("\u6587\u672C\u7F16\u8F91\u533A\uFF1A");
  304. label_1.setBounds(449, 16, 93, 15);
  305. contentPane.add(label_1);
  306. }
  307. public static void method1(String file, String conent) {
  308. BufferedWriter out = null;
  309. try {
  310. out = new BufferedWriter(new OutputStreamWriter(
  311. new FileOutputStream(file, true)));
  312. out.write(conent);
  313. } catch (Exception e) {
  314. e.printStackTrace();
  315. } finally {
  316. try {
  317. if (out != null) {
  318. out.close();
  319. }
  320. } catch (IOException e) {
  321. e.printStackTrace();
  322. }
  323. }
  324. }
  325. }

下面解释一下为什么没有做好注释合作说明文档,因为我做注释做到一半的时候,出现了一点事故,导致没有来得及保存的文件丢失了,所以,请大家谨记,时刻记得保存编辑的被容,否则后果真的很严重。

代码追补解释,下面的代码块是我程序里面做的不好的,违背了代码的复用性原则,请予以为戒:

代码块1:

  1. //代码的作用就是实现对特定的文件进行读取,并存入到String中,方便使用
  2. StringBuffer sb = new StringBuffer();
  3. String length = "";
  4. String fileTitle;
  5. String fileContent;
  6. try {
  7. BufferedReader reader = new BufferedReader(new FileReader(
  8. "F://test.txt"));
  9. while ((length = reader.readLine()) != null) {
  10. sb.append(length);
  11. }
  12. fileContent = sb.toString();
  13. taShow.setText("您打开的文件的内容是:" + fileContent);
  14. CursorPosition = e.getDot();
  15. } catch (Exception e1) {
  16. // TODO Auto-generated catch block
  17. e1.printStackTrace();
  18. }

代码块2:

  1. //代码实现了向特定的文件内追加数据,若想要覆盖式追加,把参数true去掉即可,默认为覆盖式添加数据
  2. public static void method1(String file, String conent) {
  3. BufferedWriter out = null;
  4. try {
  5. out = new BufferedWriter(new OutputStreamWriter(
  6. new FileOutputStream(file, true)));
  7. out.write(conent);
  8. } catch (Exception e) {
  9. e.printStackTrace();
  10. } finally {
  11. try {
  12. if (out != null) {
  13. out.close();
  14. }
  15. } catch (IOException e) {
  16. e.printStackTrace();
  17. }
  18. }
  19. }

代码块3:

在统计模块中:

  1. btnTotal.addActionListener(new ActionListener() {
  2. @Override
  3. public void actionPerformed(ActionEvent e) {
  4. // TODO Auto-generated method stub
  5. StringBuffer sb = new StringBuffer();
  6. String length = "";
  7. String fileTitle;
  8. String fileContent;
  9. try {
  10. BufferedReader reader = new BufferedReader(new FileReader(
  11. "F://test.txt"));
  12. while ((length = reader.readLine()) != null) {
  13. sb.append(length);
  14. }
  15. fileContent = sb.toString();
  16. new Total().find(fileContent);
  17. String flag = "数据信息统计结果如下:" + "\n" + "汉字数目:";
  18. flag += new Total().chineseCount;
  19. flag += "\n英文字母个数:";
  20. flag += new Total().englishCount;
  21. flag += "\n特殊字符个数:";
  22. flag += new Total().numberCount;
  23. flag += "\n总的字符个数为:"
  24. + (new Total().chineseCount
  25. + new Total().englishCount + new Total().numberCount);
  26. taShow.setText(flag);
  27. new Total().chineseCount = 0;
  28. new Total().englishCount = 0;
  29. new Total().numberCount = 0;
  30. } catch (Exception ec) {
  31. ec.printStackTrace();
  32. }
  33. }

其中使用到的new Total().find()方法,详见下面的代码:

  1. package Editer;
  2. /**
  3. * 分别统计出其中字符串中汉字,英文字母,数字,其他字符数量
  4. * @author wWX154783
  5. *
  6. */
  7. public class Total
  8. {
  9. static String E1,E2,E3;
  10. String str="a12中国3@b&4语*言3c";
  11. static int chineseCount = 0;
  12. static int englishCount = 0;
  13. static int numberCount = 0;
  14. public void find(String str)
  15. {
  16. String E1 = "[\u4e00-\u9fa5]";// 中文
  17. String E2 = "[a-zA-Z]";// 英文
  18. String E3 = "[0-9]";// 数字
  19. String temp;
  20. for (int i = 0; i < str.length(); i++)
  21. {
  22. temp = String.valueOf(str.charAt(i));
  23. if (temp.matches(E1))
  24. {
  25. chineseCount++;
  26. }
  27. if (temp.matches(E2))
  28. {
  29. englishCount++;
  30. }
  31. if (temp.matches(E3))
  32. {
  33. numberCount++;
  34. }
  35. }
  36. System.out.println("汉字数:" + chineseCount);
  37. System.out.println("英文数:" + englishCount);
  38. System.out.println("数字数:" + numberCount);
  39. System.out.println("特殊字符:" + (str.length() - (chineseCount + englishCount + numberCount)));
  40. }
  41. }

好了,下面是程序运行后得到的界面,在此我要声明的是,程序仍然存在一些bug,表现在获得光标位置时的java.lang.IllegalStateException: Attempt to mutate in notification异常,主要还是线程相关,如果博友能解决,还望不吝赐教









能力有限,希望和大家一起进步,一同提高!

接下来的是我从网上找到的一份用C语言实现的简易的文本编辑器的实现,个人认为较之,我的简直就是太菜了,现在将代码贴出来,希望这篇C语言的经典能让更多的人知晓:

  1. #include <stdio.h>
  2. #define MAXLEN 80
  3. #define MAXLINE 200
  4. char buffer[MAXLEN],fname[120];
  5. char *lineptr[MAXLINE];
  6. FILE *fp;
  7. void edit(),replace(),insert(),delete(),quit();
  8. char comch[]="EeRrIiDdQq";/*命令符*/
  9. void(*comfun[])()={edit,replace,insert,delete,quit};/*对应处理函数*/
  10. int modified=0,/*正文被修改标志*/
  11. last;/*当前正文行数*/
  12. char *chpt;/*输入命令行字符指针*/
  13. main()
  14. {
  15. int j;
  16. last=0;
  17. while(1)
  18. {
  19. printf("\nInput a command:[e,r,i,d,q].\n");
  20. gets(buffer);/*读入命令行*/
  21. for(chpt=buffer;*chpt=='\0'||*chpt=='\t';chpt++);/*掠过空白符*/
  22. if(*chpt=='\0') continue;/*空行重新输入*/
  23. for(j=0;comch[j]!='\0'&&comch[j]!=*chpt;j++);/*查命令符*/
  24. if(comch[j]=='\0') continue;/*非法命令符*/
  25. chpt++;/*掠过命令符,指向参数*/
  26. (*comfun[j/2])();/*执行对应函数*/
  27. fprintf(stdout,"The text is:\n");
  28. for(j=0;j<last;j++)/*显示正文*/
  29. fputs(lineptr[j],stdout);
  30. }
  31. }
  32. void quit()
  33. {
  34. int c;
  35. if(modified)/* 如正文被修改 */
  36. {
  37. printf("Save? (y/n)");
  38. while(!(((c=getchar())>='a'&&c<='z')||(c>='A'&&c<='Z')));
  39. if(c=='y'||c=='Y')
  40. save(fname); /* 保存被修改过的正文 */
  41. }
  42. for(c=0;c<last;c++)
  43. free(lineptr[c]); /* 释放内存 */
  44. exit(0);
  45. }
  46. void insert()
  47. {
  48. int k,m,i;
  49. sscanf(chpt,"%d%d",&k,&m); /* 读入参数 */
  50. if(m<0||m>last||last+k>=MAXLINE)/* 检查参数合理性 */
  51. {
  52. printf("Error!\n");
  53. return;
  54. }
  55. for(i=last;i>m;i--)/* 后继行向后移 */
  56. lineptr[i+k-1]=lineptr[i-1];
  57. for(i=0;i<k;i++) /* 读入k行正文,并插入 */
  58. {
  59. fgets(buffer,MAXLEN,stdin);
  60. lineptr[m+i]=(char *)malloc(strlen(buffer)+1);
  61. strcpy(lineptr[m+i],buffer);
  62. }
  63. last+=k; /* 修正正文行数 */
  64. modified=1; /* 正文被修改 */
  65. }
  66. void delete()
  67. {
  68. int i,j,m,n;
  69. sscanf(chpt,"%d%d",&m,&n); /* 读入参数 */
  70. if(m<=0||m>last||n<m) /* 检查参数合理性 */
  71. {
  72. printf("Error!\n");
  73. return;
  74. }
  75. if(n>last)
  76. n=last; /* 修正参数 */
  77. for(i=m;i<=n;i++) /* 删除正文 */
  78. free(lineptr[i-1]);
  79. for(i=m,j=n+1;j<=last;i++,j++)
  80. lineptr[i-1]=lineptr[j-1];
  81. last=i-1; /* 修正正文行数 */
  82. modified=1; /* 正文被修改 */
  83. }
  84. void replace()
  85. {
  86. int k,m,n,i,j;
  87. sscanf(chpt,"%d%d%d",&k,&m,&n); /* 读入参数 */
  88. if(m<=0||m>last||n<m||last-(n-m+1)+k>=MAXLINE)/* 检查参数合理性 */
  89. {
  90. printf("Error!\n");
  91. return;
  92. }
  93. /* 先完成删除 */
  94. if(n>last)
  95. n=last; /* 修正参数 */
  96. for(i=m;i<=n;i++) /* 删除正文 */
  97. free(lineptr[i-1]);
  98. for(i=m,j=n+1;j<=last;i++,j++)
  99. lineptr[i-1]=lineptr[j-1];
  100. last=i-1;
  101. /* 以下完成插入 */
  102. for(i=last;i>=m;i--)
  103. lineptr[i+k-1]=lineptr[i-1];
  104. for(i=0;i<k;i++)
  105. {
  106. fgets(buffer,MAXLEN,stdin);
  107. lineptr[m+i-1]=(char *)malloc(strlen(buffer)+1);
  108. strcpy(lineptr[m+i-1],buffer);
  109. }
  110. last+=k; /* 修正正文行数 */
  111. modified=1; /* 正文被修改 */
  112. }
  113. save(char *fname) /* 保存文件 */
  114. {
  115. int i;
  116. FILE *fp;
  117. if((fp=fopen(fname,"w"))==NULL)
  118. {
  119. fprintf(stderr,"Can't open %s.\n",fname);
  120. exit(1);
  121. }
  122. for(i=0;i<last;i++)
  123. {
  124. fputs(lineptr[i],fp);
  125. free(lineptr[i]);
  126. }
  127. fclose(fp);
  128. }
  129. void edit() /* 编辑命令 */
  130. {
  131. int i;
  132. FILE *fp;
  133. i=sscanf(chpt,"%s",fname); /* 读入文件名 */
  134. if(i!=1)
  135. {
  136. printf("Enter file name.\n");
  137. scanf("%s",fname);
  138. }
  139. if((fp=fopen(fname,"r"))==NULL) /* 读打开 */
  140. {
  141. fp=fopen(fname,"w"); /* 如不存在,则创建文件 */
  142. fclose(fp);
  143. fp=fopen(fname,"r"); /* 重新读打开 */
  144. }
  145. i=0;
  146. while(fgets(buffer,MAXLEN,fp)==buffer)
  147. {
  148. lineptr[i]=(char *)malloc(strlen(buffer)+1);
  149. strcpy(lineptr[i++],buffer);
  150. }
  151. fclose(fp);
  152. last=i;
  153. }

Java实现简易的文本编辑器的更多相关文章

  1. 简易富文本编辑器bootstrap-wysiwyg源码注释

    好久没写随笔了,因为最近比较忙,小公司基本都是一个前端干所有属于和部分不属于前端的事情,所以就没空弄了,即使想分享,也因为没有时间和精力就搁置了. 这周周六日休息,正好时间比较充裕(ps:目前处在单休 ...

  2. Java开发之富文本编辑器TinyMCE

    一.题外话 最近负责了一个cms网站的运维,里面存在很多和编辑器有关的问题,比如编辑一些新闻博客,论文模块.系统采用的是FCKEditor,自我感觉不是很好,如下图 特别是在用户想插入一个图片的话,就 ...

  3. C++ mfc 简易文本编辑器 遇到的一些问题

    [题目40]简易文本编辑器. 设计一个简易的文本编辑器. 设计要求: (1) 具有图形菜单界面: (2) 查找,替换(等长,不等长),插入(插串,文本块的插入).文本块移动(行块,列块移动),删除; ...

  4. Java-Swing中使用Web富文本编辑器

    资料下载 (截取出了邮件发送的功能.) 2018/11/10 因为要 win7 电脑 IE 8 的原因,使用了 jxBrower 拓展,更容易使用,参考链接(推荐) 问题介绍 window客户端软件的 ...

  5. Java实现"命令式"简易文本编辑器原型

    源自早先想法, 打算从界面方向做些尝试. 找到个简单文本编辑器的实现: Simple Text Editor - Java Tutorials. 原本的菜单/按钮界面如下. 包括基本功能: 新建/打开 ...

  6. java文本编辑器5

    package peng_jun; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.* ...

  7. Java编写的文本编辑器(菜鸟作品)

    //这是主窗体文件 Wordwin.java import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.sw ...

  8. java文本编辑器v2.0 图形用户界面

    package 文本编辑器; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; impor ...

  9. 前后端分离ueditor富文本编辑器的使用-Java版本

    最近在写一个自己的后台管理系统(主要是写着玩的,用来熟悉后端java的知识,目前只是会简单的写点接口),想在项目中编写一个发布新闻文章的功能,想到了使用百度的ueditor富文本编辑器,网上找了很多j ...

随机推荐

  1. PHP Switch 语句

    PHP Switch 语句 switch 语句用于根据多个不同条件执行不同动作. PHP Switch 语句 如果您希望有选择地执行若干代码块之一,请使用 switch 语句. 语法 switch ( ...

  2. PHP 高级过滤器

    PHP 高级过滤器 检测一个数字是否在一个范围内 以下实例使用了 filter_var() 函数来检测一个 INT 型的变量是否在  1 到 200 内: 实例 <?php$int = 122; ...

  3. Detailed Item Cost Report (XML) timed out waiting for the Output Post-processor to finish

    In this Document   Symptoms   Cause   Solution   References APPLIES TO: Oracle Cost Management - Ver ...

  4. ubuntu日志文件管理

    众所周知,ubuntu的日志文件会越来越大,需要定期管理 logrotate是个十分有用的工具,它可以自动对日志进行截断(或轮循).压缩以及删除旧的日志文件.例如,你可以设置logrotate,让/v ...

  5. Android Multimedia框架总结(十六)Camera2框架之openCamera及session过程

    转载请把头部出处链接和尾部二维码一起转载,本文出自逆流的鱼yuiop:http://blog.csdn.net/hejjunlin/article/details/52942533 前言:前一篇介绍了 ...

  6. 网络爬虫框架Scrapy简介

    作者: 黄进(QQ:7149101) 一. 网络爬虫 网络爬虫(又被称为网页蜘蛛,网络机器人),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本:它是一个自动提取网页的程序,它为搜索引擎从万维 ...

  7. 传Lua对象到Cpp

    传Lua对象到Cpp (金庆的专栏) 摘自:http://raycast.net/lua-intf 以下代码演示了Lua函数和表传入Cpp进行处理: std::string acceptStuff(L ...

  8. NuGet包断线续传下载

    NuGet包断线续传下载(金庆的专栏)NuGet是VC的扩展,用来下载依赖包.NuGet下载没有断线续传,下载源又很容易断开.  https://nuget.org/api/v2/  https:// ...

  9. 没事不要在for循环期间增减迭代序列的成员

    >>> arr=[4, 4, 9, 7, 7] >>> for i,a in enumerate(arr): arr.pop(i) print(i,a) 4 0 4 ...

  10. Python动态展现之一

    首先: def f(): print('first') def g(): f() g() def f(): print('second') g() 结果: >>> first sec ...