易截截图软件、单文件、免安装、纯绿色、仅160KB

java HTML文件文档编辑器 使用 JTextPane

 java HTML文件文档编辑器 使用 JTextPane 
/* HTMLDocumentEditor.java
* @author: Charles Bell
* @version: May 27, 2002
*/
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.undo.*;
/**HTML文件文档编辑器*/
public class HTMLDocumentEditor extends JFrame implements ActionListener
{
 /** 声明一个网页文档对象变量*/
 private HTMLDocument document;
 /** 创建一个文本编辑板*/
 private JTextPane textPane = new JTextPane();
 private boolean debug = false;
 /** 声明一个文件对象变量*/
 private File currentFile;
 
 /** 侦听在当前文档上的编辑器 */
 protected UndoableEditListener undoHandler = new UndoHandler();
 
 /** 添加撤消管理器 */
 protected UndoManager undo = new UndoManager();
 
 /** 添加撤消侦听器*/
 private UndoAction undoAction = new UndoAction();
 /** 添加恢复侦听器*/
 private RedoAction redoAction = new RedoAction();
 
 /** 添加剪切侦听器*/
 private Action cutAction = new DefaultEditorKit.CutAction();
 /** 添加复制侦听器*/
 private Action copyAction = new DefaultEditorKit.CopyAction();
 /** 添加粘贴侦听器*/
 private Action pasteAction = new DefaultEditorKit.PasteAction();
 
 /** 添加加粗侦听器*/
 private Action boldAction = new StyledEditorKit.BoldAction();
 /** 添加加下划线侦听器*/
 private Action underlineAction = new StyledEditorKit.UnderlineAction();
 /** 添加倾斜侦听器*/
 private Action italicAction = new StyledEditorKit.ItalicAction();
 
 private Action insertBreakAction = new DefaultEditorKit.InsertBreakAction();
 private HTMLEditorKit.InsertHTMLTextAction unorderedListAction = new HTMLEditorKit.InsertHTMLTextAction("Bullets", "<


相关文档:

Java实现目录查找与文本阅读

 1.实现文本阅读
package AllAboutFile;
/**
 *
 * @author lucifer
 */
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class FileViewer extends Frame implements ActionListener{
     String directory;
     Text ......

java如何从控制台获得一行输入

  /**
  *
  * @param par
  *            入力名
  * @return 入力値
  */
 public static String inputfromConsole(String par) {
  System.out.println(par);
  InputStreamReader ......

java笔试汇总(2)

41、是否可以继承String类?
String类是final类故不可以继承。
42、swtich是否能作用在byte上,是否能作用在long上,是否能作用在String上?
switch(expr1)中,expr1是一个整数表达式。因此传递给 switch 和 case 语句的参数应该是 int、 short、 char 或者 byte。long,st ......

java单态模式讲解

单态定义:
        Singleton模式主要作用是保证在Java应用程序中,一个类Class只有一个实例存在。
        Singleton模式就为我们提供了这样实现的可能。使用Singleton的好处还在于可以节省内存,因为它限制了实例的个数,有利于Java垃圾回收(garbage col ......

java 集合类


集合Collection接口
--Collection 是任何对象组,元素各自独立,通常拥有相同的套用规则。Set List由它派生。
基本操作 增加元素add(Object obj); addAll(Collection c);
删除元素 remove(Object obj); removeAll(Collection c);
求交集 retainAll(Collection c);
删除元素 remove(Object obj); removeAll(Collectio ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号