当前位置: 首页>>代码示例>>Java>>正文


Java HTMLEditorKit.InsertHTMLTextAction方法代码示例

本文整理汇总了Java中javax.swing.text.html.HTMLEditorKit.InsertHTMLTextAction方法的典型用法代码示例。如果您正苦于以下问题:Java HTMLEditorKit.InsertHTMLTextAction方法的具体用法?Java HTMLEditorKit.InsertHTMLTextAction怎么用?Java HTMLEditorKit.InsertHTMLTextAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.html.HTMLEditorKit的用法示例。


在下文中一共展示了HTMLEditorKit.InsertHTMLTextAction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
    String elName =
        document
            .getParagraphElement(editor.getCaretPosition())
            .getName();
    /*
     * if ((elName.toUpperCase().equals("PRE")) ||
     * (elName.toUpperCase().equals("P-IMPLIED"))) {
     * editor.replaceSelection("\r"); return;
     */
    HTML.Tag tag = HTML.getTag(elName);
    if (elName.toUpperCase().equals("P-IMPLIED"))
        tag = HTML.Tag.IMPLIED;

    HTMLEditorKit.InsertHTMLTextAction hta =
        new HTMLEditorKit.InsertHTMLTextAction(
            "insertBR",
            "<br>",
            tag,
            HTML.Tag.BR);
    hta.actionPerformed(e);

    //insertHTML("<br>",editor.getCaretPosition());

}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:26,代码来源:HTMLEditor.java

示例2: ulActionB_actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void ulActionB_actionPerformed(ActionEvent e) {
	String parentname =
		document
			.getParagraphElement(editor.getCaretPosition())
			.getParentElement()
			.getName();
	HTML.Tag parentTag = HTML.getTag(parentname);
	HTMLEditorKit.InsertHTMLTextAction ulAction =
		new HTMLEditorKit.InsertHTMLTextAction(
			"insertUL",
			"<ul><li></li></ul>",
			parentTag,
			HTML.Tag.UL);
	ulAction.actionPerformed(e);

}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:17,代码来源:HTMLEditor.java

示例3: actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
	String elName =
		document
			.getParagraphElement(editor.getCaretPosition())
			.getName();
	/*
	 * if ((elName.toUpperCase().equals("PRE")) ||
	 * (elName.toUpperCase().equals("P-IMPLIED"))) {
	 * editor.replaceSelection("\r"); return;
	 */
	HTML.Tag tag = HTML.getTag(elName);
	if (elName.toUpperCase().equals("P-IMPLIED"))
		tag = HTML.Tag.IMPLIED;

	HTMLEditorKit.InsertHTMLTextAction hta =
		new HTMLEditorKit.InsertHTMLTextAction(
			"insertBR",
			"<br>",
			tag,
			HTML.Tag.BR);
	hta.actionPerformed(e);

	//insertHTML("<br>",editor.getCaretPosition());

}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:26,代码来源:HTMLEditor.java

示例4: olActionB_actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void olActionB_actionPerformed(ActionEvent e) {
	String parentname =
		document
			.getParagraphElement(editor.getCaretPosition())
			.getParentElement()
			.getName();
	HTML.Tag parentTag = HTML.getTag(parentname);
	HTMLEditorKit.InsertHTMLTextAction olAction =
		new HTMLEditorKit.InsertHTMLTextAction(
			"insertOL",
			"<ol><li></li></ol>",
			parentTag,
			HTML.Tag.OL);
	olAction.actionPerformed(e);
	//removeIfEmpty(document.getParagraphElement(editor.getCaretPosition()-1));
	list = true;
}
 
开发者ID:ser316asu,项目名称:SER316-Munich,代码行数:18,代码来源:HTMLEditor.java

示例5: olActionB_actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void olActionB_actionPerformed(ActionEvent e) {
	String parentname =
		document
			.getParagraphElement(editor.getCaretPosition())
			.getParentElement()
			.getName();
	HTML.Tag parentTag = HTML.getTag(parentname);
	HTMLEditorKit.InsertHTMLTextAction olAction =
		new HTMLEditorKit.InsertHTMLTextAction(
			"insertOL",
			"<ol><li></li></ol>",
			parentTag,
			HTML.Tag.OL);
	olAction.actionPerformed(e);
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:16,代码来源:HTMLEditor.java

示例6: ulActionB_actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void ulActionB_actionPerformed(ActionEvent e) {
    String parentname =
        document
            .getParagraphElement(editor.getCaretPosition())
            .getParentElement()
            .getName();
    HTML.Tag parentTag = HTML.getTag(parentname);
    HTMLEditorKit.InsertHTMLTextAction ulAction =
        new HTMLEditorKit.InsertHTMLTextAction(
            "insertUL",
            "<ul><li></li></ul>",
            parentTag,
            HTML.Tag.UL);
    ulAction.actionPerformed(e);
    //removeIfEmpty(document.getParagraphElement(editor.getCaretPosition()-1));
    list = true;
    /*
     * Element pEl =
     * document.getParagraphElement(editor.getCaretPosition());
     * StringWriter sw = new StringWriter(); try { editorKit.write(sw,
     * document, pEl.getStartOffset(),
     * pEl.getEndOffset()-pEl.getStartOffset()); String copy =
     * sw.toString(); String elName = pEl.getName(); copy =
     * copy.substring(copy.indexOf(" <"+elName)); copy =
     * copy.substring(0,copy.indexOf(" </"+elName)+elName.length()+3);
     * document.setOuterHTML(pEl, " <ul><li> "+copy+" </li></ul> ");
     * Util.debug(copy); } catch (Exception ex){
     * ex.printStackTrace();
     */

}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:32,代码来源:HTMLEditor.java

示例7: ulActionB_actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void ulActionB_actionPerformed(ActionEvent e) {
	String parentname =
		document
			.getParagraphElement(editor.getCaretPosition())
			.getParentElement()
			.getName();
	HTML.Tag parentTag = HTML.getTag(parentname);
	HTMLEditorKit.InsertHTMLTextAction ulAction =
		new HTMLEditorKit.InsertHTMLTextAction(
			"insertUL",
			"<ul><li></li></ul>",
			parentTag,
			HTML.Tag.UL);
	ulAction.actionPerformed(e);
	//removeIfEmpty(document.getParagraphElement(editor.getCaretPosition()-1));
	list = true;
	/*
	 * Element pEl =
	 * document.getParagraphElement(editor.getCaretPosition());
	 * StringWriter sw = new StringWriter(); try { editorKit.write(sw,
	 * document, pEl.getStartOffset(),
	 * pEl.getEndOffset()-pEl.getStartOffset()); String copy =
	 * sw.toString(); String elName = pEl.getName(); copy =
	 * copy.substring(copy.indexOf(" <"+elName)); copy =
	 * copy.substring(0,copy.indexOf(" </"+elName)+elName.length()+3);
	 * document.setOuterHTML(pEl, " <ul><li> "+copy+" </li></ul> ");
	 * System.out.println(copy); } catch (Exception ex){
	 * ex.printStackTrace();
	 */

}
 
开发者ID:ser316asu,项目名称:SER316-Aachen,代码行数:32,代码来源:HTMLEditor.java

示例8: actionPerformed

import javax.swing.text.html.HTMLEditorKit; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
	String elName =
		document
			.getParagraphElement(editor.getCaretPosition())
			.getName();
	/*
	 * if ((elName.toUpperCase().equals("PRE")) ||
	 * (elName.toUpperCase().equals("P-IMPLIED"))) {
	 * editor.replaceSelection("\r"); return;
	 */
	HTML.Tag tag = HTML.getTag(elName);
	if (elName.toUpperCase().equals("P-IMPLIED"))
	{
		tag = HTML.Tag.IMPLIED;
	}

	HTMLEditorKit.InsertHTMLTextAction hta =
		new HTMLEditorKit.InsertHTMLTextAction(
			"insertBR",
			"<br>",
			tag,
			HTML.Tag.BR);
	hta.actionPerformed(e);

	//insertHTML("<br>",editor.getCaretPosition());

}
 
开发者ID:ser316asu,项目名称:SER316-Aachen,代码行数:28,代码来源:HTMLEditor.java


注:本文中的javax.swing.text.html.HTMLEditorKit.InsertHTMLTextAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。