class HTMLTextPane extends JTextPane {

  int maximum_width;
  String text;
  public Dimension preferredDimension;
  Visual comp = null;
  String htmltxt;

  public HTMLTextPane(Visual comp) {
    this.comp = comp;
    maximum_width = comp.maxWidth - 10;
    init();
  }

  public HTMLTextPane() {
    maximum_width = 400;
    init();
  }

  private void init() {
    setContentType("text/html");
  }

  @Override
  public void setText(String text) {<FILL_FUNCTION_BODY>}

  @Override
  public String getText() {
    return this.text;
  }

}

    this.text = text;
    if (comp != null) {
      maximum_width = comp.maxWidth - 2 * comp.PADDING_X;
      htmltxt = "<html><div style='" + comp.getStyleString() + "'>"
              + text + "</div></html>";
    } else {
      htmltxt = "<html><font size=5>"+text+"</font></html>";
    }
    super.setText(htmltxt);
    JTextPane tp = new JTextPane();
    tp.setText(htmltxt);
    if (getPreferredSize().getWidth() > maximum_width) {
      // hack to limit the width of the text to width
      if (comp != null) {
        htmltxt = "<html><div style='width:" + maximum_width + ";" + comp.getStyleString() + "'>"
                  + text + "</div></html>";
      } else {
        htmltxt = "<html><div width='"+maximum_width+"'><font size=5>"+text+"</font></div></html>";
      }
      super.setText(htmltxt);
    }
    setSize(getPreferredSize());
  
<methods>public void <init>() ,public void <init>(javax.swing.text.StyledDocument) ,public javax.swing.text.Style addStyle(java.lang.String, javax.swing.text.Style) ,public javax.swing.text.AttributeSet getCharacterAttributes() ,public javax.swing.text.MutableAttributeSet getInputAttributes() ,public javax.swing.text.Style getLogicalStyle() ,public javax.swing.text.AttributeSet getParagraphAttributes() ,public javax.swing.text.Style getStyle(java.lang.String) ,public javax.swing.text.StyledDocument getStyledDocument() ,public java.lang.String getUIClassID() ,public void insertComponent(java.awt.Component) ,public void insertIcon(javax.swing.Icon) ,public void removeStyle(java.lang.String) ,public void replaceSelection(java.lang.String) ,public void setCharacterAttributes(javax.swing.text.AttributeSet, boolean) ,public void setDocument(javax.swing.text.Document) ,public final void setEditorKit(javax.swing.text.EditorKit) ,public void setLogicalStyle(javax.swing.text.Style) ,public void setParagraphAttributes(javax.swing.text.AttributeSet, boolean) ,public void setStyledDocument(javax.swing.text.StyledDocument) <variables>private static final java.lang.String uiClassID