Example usage for javax.swing.text IconView IconView

List of usage examples for javax.swing.text IconView IconView

Introduction

In this page you can find the example usage for javax.swing.text IconView IconView.

Prototype

public IconView(Element elem) 

Source Link

Document

Creates a new icon view that represents an element.

Usage

From source file:Main.java

public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            return new WrapLabelView(elem);
        } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
            return new ParagraphView(elem);
        } else if (kind.equals(AbstractDocument.SectionElementName)) {
            return new BoxView(elem, View.Y_AXIS);
        } else if (kind.equals(StyleConstants.ComponentElementName)) {
            return new ComponentView(elem);
        } else if (kind.equals(StyleConstants.IconElementName)) {
            return new IconView(elem);
        }/*from  ww  w.j av a  2  s  .com*/
    }
    return new LabelView(elem);
}

From source file:Main.java

@Override
public View create(Element elem) {
    View result = null;/*from   w  ww .  j a  v  a 2s. c  o  m*/
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            result = new MyLabelView(elem);
        } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
            result = new ParagraphView(elem);
        } else if (kind.equals(AbstractDocument.SectionElementName)) {
            result = new BoxView(elem, View.Y_AXIS);
        } else if (kind.equals(StyleConstants.ComponentElementName)) {
            result = new ComponentView(elem);
        } else if (kind.equals(StyleConstants.IconElementName)) {
            result = new IconView(elem);
        } else {
            result = new LabelView(elem);
        }
    } else {
        result = super.create(elem);
    }
    return result;
}

From source file:Main.java

public View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        if (kind.equals(AbstractDocument.ContentElementName)) {
            return new MyLabelView(elem);
        } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
            return new ParagraphView(elem);
        } else if (kind.equals(AbstractDocument.SectionElementName)) {
            return new BoxView(elem, View.Y_AXIS);
        } else if (kind.equals(StyleConstants.ComponentElementName)) {
            return new ComponentView(elem);
        } else if (kind.equals(StyleConstants.IconElementName)) {
            return new IconView(elem);
        }/*from  w ww  .  j ava2  s  .c  o  m*/
    }
    return new LabelView(elem);
}