本文整理汇总了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());
}
示例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);
}
示例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());
}
示例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;
}
示例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);
}
示例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();
*/
}
示例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();
*/
}
示例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());
}