當前位置: 首頁>>代碼示例>>Java>>正文


Java HTML.Tag方法代碼示例

本文整理匯總了Java中javax.swing.text.html.HTML.Tag方法的典型用法代碼示例。如果您正苦於以下問題:Java HTML.Tag方法的具體用法?Java HTML.Tag怎麽用?Java HTML.Tag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.text.html.HTML的用法示例。


在下文中一共展示了HTML.Tag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);

}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:17,代碼來源:HTMLEditor.java

示例2: 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());

}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:26,代碼來源:HTMLEditor.java

示例3: writeEmbeddedTags

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
/**
 * Searches for embedded tags in the AttributeSet
 * and writes them out.  It also stores these tags in a vector
 * so that when appropriate the corresponding end tags can be
 * written out.
 *
 * @exception IOException on any I/O error
 */
protected void writeEmbeddedTags(AttributeSet attr) throws IOException {

    // translate css attributes to html
    attr = convertToHTML(attr, oConvAttr);

    Enumeration names = attr.getAttributeNames();
    while (names.hasMoreElements()) {
        Object name = names.nextElement();
        if (name instanceof HTML.Tag) {
            HTML.Tag tag = (HTML.Tag) name;
            if (tag == HTML.Tag.FORM || tags.contains(tag)) {
                continue;
            }
            write('<');
            write(tag.toString());
            Object o = attr.getAttribute(tag);
            if (o != null && o instanceof AttributeSet) {
                writeAttributes((AttributeSet) o);
            }
            write('>');
            tags.addElement(tag);
            tagValues.addElement(o);
        }
    }
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:34,代碼來源:AltHTMLWriter.java

示例4: handleStartTag

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
public @Override void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {

            if ( t == HTML.Tag.DT ) {
                where = IN_DT;
                currentDii = null;
            }
            else if ( t == HTML.Tag.A && where == IN_DT ) {
                where = IN_AREF;
                Object val = a.getAttribute( HTML.Attribute.HREF );
                if ( val != null ) {
                    hrefVal = val.toString();
                    currentDii = new DocIndexItem( null, null, contextURL, hrefVal );
                }
            }
            else if ( t == HTML.Tag.A && (where == IN_DESCRIPTION_SUFFIX || where == IN_DESCRIPTION) ) {
                // Just ignore
            }
            else if ( (t == HTML.Tag.B || t == HTML.Tag.SPAN) && where == IN_AREF ) {
                where = IN_AREF;
            }
            else {
                where = IN_BALAST;
            }
        }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:SearchThreadJdk12_japan.java

示例5: noMatchForTagInAttributes

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
/**
 * Searches the attribute set for a tag, both of which
 * are passed in as a parameter.  Returns true if no match is found
 * and false otherwise.
 */
private boolean noMatchForTagInAttributes(AttributeSet attr, HTML.Tag t, Object tagValue) {
    if (attr != null && attr.isDefined(t)) {
        Object newValue = attr.getAttribute(t);

        if ((tagValue == null) ? (newValue == null) : (newValue != null && tagValue.equals(newValue))) {
            return false;
        }
    }
    return true;
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:16,代碼來源:AltHTMLWriter.java

示例6: writeAttributes

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
/**
 * Writes out the attribute set.  Ignores all
 * attributes with a key of type HTML.Tag,
 * attributes with a key of type StyleConstants,
 * and attributes with a key of type
 * HTML.Attribute.ENDTAG.
 *
 * @param attr   an AttributeSet
 * @exception IOException on any I/O error
 *
 */
protected void writeAttributes(AttributeSet attr) throws IOException {
    // translate css attributes to html
    convAttr.removeAttributes(convAttr);
    convertToHTML32(attr, convAttr);

    Enumeration names = convAttr.getAttributeNames();
    while (names.hasMoreElements()) {
        Object name = names.nextElement();
        if (name instanceof HTML.Tag || name instanceof StyleConstants || name == HTML.Attribute.ENDTAG) {
            continue;
        }
        write(" " + name + "=\"" + convAttr.getAttribute(name) + "\"");
    }
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:26,代碼來源:AltHTMLWriter.java

示例7: isBlockTag

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
/**
 * Determines if the HTML.Tag associated with the
 * element is a block tag.
 *
 * @param attr  an AttributeSet
 * @return  true if tag is block tag, false otherwise.
 */
protected boolean isBlockTag(AttributeSet attr) {
    Object o = attr.getAttribute(StyleConstants.NameAttribute);
    if (o instanceof HTML.Tag) {
        HTML.Tag name = (HTML.Tag) o;
        return name.isBlock();
    }
    return false;
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:16,代碼來源:AltHTMLWriter.java

示例8: create

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
@Override
public View create(Element elem) {
    Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
    if (o instanceof HTML.Tag) {
        HTML.Tag kind = (HTML.Tag) o;
        if (kind == HTML.Tag.IMG) {
            return new ClasspathImageView(elem);
        }
    }
    return super.create(elem);
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:12,代碼來源:ClasspathHtmlEditorKit.java

示例9: handleEndTag

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
@Override
public void handleEndTag(HTML.Tag t, int pos) {
    String tag = t.toString();
    logger.log(Level.FINE, "EndTag <{0}>", tag);
    if (TAG_TITLE.equalsIgnoreCase(tag)) {
        readingTitle = false;
    }
    if (TAG_FORM.equalsIgnoreCase(tag)) {
        readingForm = false;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ButtonsHTMLParser.java

示例10: 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());

}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:28,代碼來源:HTMLEditor.java

示例11: handleStartTag

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
public @Override void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
    if (t == HTML.Tag.BODY) {
        try {
            this.in.close ();
        } catch (IOException ioe) {/*Ignore it*/}
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:JavadocRegistry.java

示例12: 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();
	 */

}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:32,代碼來源:HTMLEditor.java

示例13: handleSimpleTag

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) {
    elist.add(pIndent() + "Tag(<" + t.toString() + ">, " +
            a.getAttributeCount() + " attrs)");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:5,代碼來源:bug7165725.java

示例14: handleStartTag

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos) {
    elist.add(pIndent() + "Tag start(<" + t.toString() + " " + a + ">, " +
            a.getAttributeCount() + " attrs)");
    indent();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:bug7165725.java

示例15: closeOutUnwantedEmbeddedTags

import javax.swing.text.html.HTML; //導入方法依賴的package包/類
/**
 * Searches the attribute set and for each tag
 * that is stored in the tag vector.  If the tag isnt found,
 * then the tag is removed from the vector and a corresponding
 * end tag is written out.
 *
 * @exception IOException on any I/O error
 */
protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException {

    tagsToRemove.removeAllElements();

    // translate css attributes to html
    attr = convertToHTML(attr, null);

    HTML.Tag t;
    Object tValue;
    int firstIndex = -1;
    int size = tags.size();
    // First, find all the tags that need to be removed.
    for (int i = size - 1; i >= 0; i--) {
        t = (HTML.Tag) tags.elementAt(i);
        tValue = tagValues.elementAt(i);
        if ((attr == null) || noMatchForTagInAttributes(attr, t, tValue)) {
            firstIndex = i;
            tagsToRemove.addElement(t);
        }
    }
    if (firstIndex != -1) {
        // Then close them out.
        boolean removeAll = ((size - firstIndex) == tagsToRemove.size());
        for (int i = size - 1; i >= firstIndex; i--) {
            t = (HTML.Tag) tags.elementAt(i);
            if (removeAll || tagsToRemove.contains(t)) {
                tags.removeElementAt(i);
                tagValues.removeElementAt(i);
            }
            write('<');
            write('/');
            write(t.toString());
            write('>');
        }
        // Have to output any tags after firstIndex that still remaing,
        // as we closed them out, but they should remain open.
        size = tags.size();
        for (int i = firstIndex; i < size; i++) {
            t = (HTML.Tag) tags.elementAt(i);
            write('<');
            write(t.toString());
            Object o = tagValues.elementAt(i);
            if (o != null && o instanceof AttributeSet) {
                writeAttributes((AttributeSet) o);
            }
            write('>');
        }
    }
}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:58,代碼來源:AltHTMLWriter.java


注:本文中的javax.swing.text.html.HTML.Tag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。