本文整理汇总了Java中javax.swing.text.html.HTML.Tag.A属性的典型用法代码示例。如果您正苦于以下问题:Java Tag.A属性的具体用法?Java Tag.A怎么用?Java Tag.A使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.text.html.HTML.Tag
的用法示例。
在下文中一共展示了Tag.A属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAnchorStartTextEnd
public void testAnchorStartTextEnd() {
SimpleAttributeSet attr = new SimpleAttributeSet();
attr.addAttribute("aaaa", "bbbb");
attr.addAttribute(HTML.Attribute.HREF, "file:///index.html");
final Tag tag = Tag.A;
reader.handleStartTag(Tag.BODY, attr, 0);
reader.handleStartTag(tag, attr, 0);
assertEquals(1, reader.charAttr.getAttributeCount());
assertEquals(1, reader.parseBuffer.size());
reader.handleText("text".toCharArray(), 0);
assertEquals(2, reader.charAttr.getAttributeCount());
assertEquals(3, reader.parseBuffer.size());
reader.handleEndTag(tag, 0);
assertEquals(0, reader.charAttr.getAttributeCount());
assertEquals(3, reader.parseBuffer.size());
}
示例2: testAnchorStartEnd
public void testAnchorStartEnd() {
SimpleAttributeSet attr = new SimpleAttributeSet();
// If href attribute is absent, after 4606 handleStartTag(Tag.A) does
// nothing. After addition the href attribute, Tag.A works as before
attr.addAttribute(HTML.Attribute.HREF, "");
final Tag tag = Tag.A;
reader.handleStartTag(tag, attr, 0);
assertEquals(1, reader.charAttr.getAttributeCount());
assertEquals(0, reader.parseBuffer.size());
reader.handleEndTag(tag, 0);
assertEquals(0, reader.charAttr.getAttributeCount());
// The rest part of the test is deleted because according to H-4574
// there is no underscore added if no text encountered. all the
// verification in that part occurs in the testAnchorStartTextEnd
}