Java Code Examples for javax.swing.text.StyleConstants#IconElementName

The following examples show how to use javax.swing.text.StyleConstants#IconElementName . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomTextPane.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public View create(final Element element) {
  final String kind = element.getName();
  if (kind != null) {
    switch (kind) {
      case AbstractDocument.ContentElementName:
        return new WrapLabelView(element);
      case AbstractDocument.ParagraphElementName:
        return new ParagraphView(element);
      case AbstractDocument.SectionElementName:
        return new BoxView(element, View.Y_AXIS);
      case StyleConstants.ComponentElementName:
        return new ComponentView(element);
      case StyleConstants.IconElementName:
        return new IconView(element);
    }
  }

  // Default to text display.
  return new LabelView(element);
}
 
Example 2
Source File: CustomTextPane.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public View create(final Element element) {
  final String kind = element.getName();
  if (kind != null) {
    switch (kind) {
      case AbstractDocument.ContentElementName:
        return new WrapLabelView(element);
      case AbstractDocument.ParagraphElementName:
        return new ParagraphView(element);
      case AbstractDocument.SectionElementName:
        return new BoxView(element, View.Y_AXIS);
      case StyleConstants.ComponentElementName:
        return new ComponentView(element);
      case StyleConstants.IconElementName:
        return new IconView(element);
    }
  }

  // Default to text display.
  return new LabelView(element);
}
 
Example 3
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
@Override public View create(Element elem) {
  switch (elem.getName()) {
    // case AbstractDocument.ContentElementName:
    //   return new WhitespaceLabelView(elem);
    case AbstractDocument.ParagraphElementName:
      return new ParagraphWithEopmView(elem);
    case AbstractDocument.SectionElementName:
      return new BoxView(elem, View.Y_AXIS);
    case StyleConstants.ComponentElementName:
      return new ComponentView(elem);
    case StyleConstants.IconElementName:
      return new IconView(elem);
    default:
      return new WhitespaceLabelView(elem);
  }
}
 
Example 4
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
@Override public View create(Element elem) {
  switch (elem.getName()) {
    // case AbstractDocument.ContentElementName:
    //   return new LabelView(elem);
    case AbstractDocument.ParagraphElementName:
      return new NoWrapParagraphView(elem);
    case AbstractDocument.SectionElementName:
      return new BoxView(elem, View.Y_AXIS);
    case StyleConstants.ComponentElementName:
      return new ComponentView(elem);
    case StyleConstants.IconElementName:
      return new IconView(elem);
    default:
      return new LabelView(elem);
  }
}
 
Example 5
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
@Override public View create(Element elem) {
  switch (elem.getName()) {
    // case AbstractDocument.ContentElementName:
    //   return new LabelView(elem);
    case AbstractDocument.ParagraphElementName:
      return new ParagraphWithEopmView(elem);
    case AbstractDocument.SectionElementName:
      return new BoxView(elem, View.Y_AXIS);
    case StyleConstants.ComponentElementName:
      return new ComponentView(elem);
    case StyleConstants.IconElementName:
      return new IconView(elem);
    default:
      return new LabelView(elem);
  }
}
 
Example 6
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
@Override public View create(Element elem) {
  switch (elem.getName()) {
    // case AbstractDocument.ContentElementName:
    //   return new LabelView(elem);
    case AbstractDocument.ParagraphElementName:
      return new ParagraphView(elem) {
        @Override protected short getBottomInset() {
          return 5;
        }
      };
    case AbstractDocument.SectionElementName:
      return new BoxView(elem, View.Y_AXIS);
    case StyleConstants.ComponentElementName:
      return new ComponentView(elem);
    case StyleConstants.IconElementName:
      return new IconView(elem);
    default:
      return new LabelView(elem);
  }
}
 
Example 7
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
@Override public View create(Element elem) {
  switch (elem.getName()) {
    // case AbstractDocument.ContentElementName:
    //   return new LabelView(elem);
    case AbstractDocument.ParagraphElementName:
      return new NoWrapParagraphView(elem);
    case AbstractDocument.SectionElementName:
      return new BoxView(elem, View.Y_AXIS);
    case StyleConstants.ComponentElementName:
      return new ComponentView(elem);
    case StyleConstants.IconElementName:
      return new IconView(elem);
    default:
      return new LabelView(elem);
  }
}
 
Example 8
Source File: MainPanel.java    From java-swing-tips with MIT License 6 votes vote down vote up
@Override public View create(Element elem) {
  switch (elem.getName()) {
    // case AbstractDocument.ContentElementName:
    //   return new LabelView(elem);
    case AbstractDocument.ParagraphElementName:
      return new ParagraphWithEndMarkView(elem);
    case AbstractDocument.SectionElementName:
      return new BoxView(elem, View.Y_AXIS);
    case StyleConstants.ComponentElementName:
      return new ComponentView(elem);
    case StyleConstants.IconElementName:
      return new IconView(elem);
    default:
      return new LabelView(elem);
  }
}
 
Example 9
Source File: MessageList.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
@Override
public javax.swing.text.View create(Element elem) {
    String kind = elem.getName();
    if (kind != null) {
        switch (kind) {
            case AbstractDocument.ContentElementName:
                return new WrapLabelView(elem);
            case AbstractDocument.ParagraphElementName:
                return new ParagraphView(elem);
            case AbstractDocument.SectionElementName:
                return new BoxView(elem, javax.swing.text.View.Y_AXIS);
            case StyleConstants.ComponentElementName:
                return new ComponentView(elem);
            case StyleConstants.IconElementName:
                return new IconView(elem);
        }
    }
    // default to text display
    return new LabelView(elem);
}