下面列出了怎么用javax.swing.text.html.ParagraphView的API类实例代码及写法,或者点击链接到github查看源代码。
@Override public View create(Element elem) {
View v = super.create(elem);
if (v instanceof LabelView) {
// the javax.swing.text.html.BRView (representing <br> tag) is a
// LabelView but must not be handled
// by a WrapLabelView. As BRView is private, check the html tag from
// elem attribute
Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
if ((o instanceof HTML.Tag) && o == HTML.Tag.BR) {
return new BRView(elem);
}
}
if (v instanceof InlineView) {
return new WrapInlineView(elem);
} else if (v instanceof ParagraphView) {
return new WrapParagraphView(elem);
}
return v;
}
@Override
public View create(Element elem) {
View v = super.create(elem);
if (v instanceof LabelView) {
// the javax.swing.text.html.BRView (representing <br> tag) is a
// LabelView but must not be handled
// by a WrapLabelView. As BRView is private, check the html tag from
// elem attribute
Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
if ((o instanceof HTML.Tag) && o == HTML.Tag.BR) {
return new BRView(elem);
}
}
if (v instanceof InlineView) {
return new WrapInlineView(elem);
} else if (v instanceof ParagraphView) {
return new WrapParagraphView(elem);
}
return v;
}
@Override
public View create(Element elem)
{
View view = super.create(elem);
viewCreated(this, view);
if (view instanceof ParagraphView)
{
return new ParagraphViewX(elem);
}
else if (view instanceof ComponentView)
{
return new MyComponentView(elem);
}
return view;
}