本文整理匯總了Java中javax.swing.text.html.HTML.getTag方法的典型用法代碼示例。如果您正苦於以下問題:Java HTML.getTag方法的具體用法?Java HTML.getTag怎麽用?Java HTML.getTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.text.html.HTML
的用法示例。
在下文中一共展示了HTML.getTag方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ulActionB_actionPerformed
import javax.swing.text.html.HTML; //導入方法依賴的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);
}
示例2: olActionB_actionPerformed
import javax.swing.text.html.HTML; //導入方法依賴的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;
}
示例3: actionPerformed
import javax.swing.text.html.HTML; //導入方法依賴的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.HTML; //導入方法依賴的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.HTML; //導入方法依賴的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.HTML; //導入方法依賴的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();
*/
}
示例7: ulActionB_actionPerformed
import javax.swing.text.html.HTML; //導入方法依賴的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();
*/
}
示例8: actionPerformed
import javax.swing.text.html.HTML; //導入方法依賴的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());
}
示例9: TagElement
import javax.swing.text.html.HTML; //導入方法依賴的package包/類
public TagElement (Element elem, boolean fictional) {
this.elem = elem;
htmlTag = HTML.getTag(elem.getName());
if (htmlTag == null) {
htmlTag = new HTML.UnknownTag(elem.getName());
}
insertedByErrorRecovery = fictional;
}
示例10: TagElement
import javax.swing.text.html.HTML; //導入方法依賴的package包/類
/**
* Creates a generic HTML TagElement class.
*
* @param elem an element
* @param fictional if {@code true} the tag is inserted by error recovery.
*/
public TagElement (Element elem, boolean fictional) {
this.elem = elem;
htmlTag = HTML.getTag(elem.getName());
if (htmlTag == null) {
htmlTag = new HTML.UnknownTag(elem.getName());
}
insertedByErrorRecovery = fictional;
}