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", "<
相关文档:
1.StudentList.java:
/**
*
* @author lucifer
*/
package JavaSerializable;
import java.util.*;
import java.io.*;
public class StudentList implements Serializable{
Vector list = new Vector(6);
public StudentList(){} ......
条件:已安装J2SE和J2EE。
Microsoft SQL Server 2000 Driver for JDBC是微软公司免费提供免费下载的一个软件,请访问: http://www.microsoft.com/sql/default.asp,下载后文件名为:setup.exe,安装后,默认路径是:%Program Files%\Microsoft SQL Server 2000 Driver for JDBC,该目录下LIB目录里有3个jar文件。 ......
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.RandomAccessFile;
/**
* 描述:追加内容到文件末尾
* @author Administrator
*
*/
public class ......
C#从Java继承而来的特点
类:在C#中类的申明与Java很相似.这是合理的因为经验告诉我们Java模型工作得很好.Java的关键字import已经被替换成using,它起到了同样的作用.一个类开始执行的起点是静态方法Main().下面的Hello World程序展示了基本的形式:
using System;
class Hello
{
static v ......
单态定义:
Singleton模式主要作用是保证在Java应用程序中,一个类Class只有一个实例存在。
Singleton模式就为我们提供了这样实现的可能。使用Singleton的好处还在于可以节省内存,因为它限制了实例的个数,有利于Java垃圾回收(garbage col ......