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", "<
相关文档:
function createTreeMenu(){//创建一个树的面板
var treeMenu = new Ext.tree.TreePanel({
lines : true,
minSize : 150,
border : false,
root : new Ext.tree.AsyncTreeNode({text : 'root'}),
loader : new Ext.tree.TreeLoader({dataUr ......
來源:http://www.blogjava.net/oxidy/articles/213105.html
1.包命名:全部字母小写:cn.package.bean
2.类命名:单词的首字母大写:SimpleBean
3.属性名称:第一个单词的首字母小写,之后每个单词的首字母大写studentName
4.方法命名:与属性命名相同:public
void sayHello()
5.常量命名:全部单词大写:final S ......
每个Java应用都可以有自己的安全管理器,它是防范恶意攻击的主要安全卫士。安全管理器通过执行运行阶段检查和访问授权,以实施应用所需的安全策略,从而保护资源免受恶意操作的攻击。实际上,安全管理器根据Java安全策略文件决定将哪组权限授予类。然而,当不可信的类和第三方应用使用JVM时,Java安全管 ......
/**
*
* @param par
* 入力名
* @return 入力値
*/
public static String inputfromConsole(String par) {
System.out.println(par);
InputStreamReader ......
1.1 不用new关键词创建类的实例
用new关键词创建类的实例时,构造函数链中的所有构造函数都会被自动调用。但如果一个对象实现了Cloneable接口,我们可以调用它的clone()方法。clone()方法不会调用任何类构造函数。
在使用设计模式(Design Pattern)的场合,如果用Factory模式创建对象,则改用clone( ......