title: Is there a way to print an AttributedString in a JLabel?
body: <p>I have an <code>AttributedString</code> with regular text and some subscripts. I would like to put the text in a <code>JLabel</code> without losing formatting. </p>
  
  <p>Is this possible? And if not, what would be the best alternative?</p>
  
  <p>EDIT: Here is some example code to further explain my question:</p>
  
  <pre><code>import javax.swing.JLabel;
  import javax.swing.JFrame;
  import java.text.AttributedString;
  import java.awt.font.TextAttribute;
  public class LabelExample extends JFrame implements Runnable
  {
    private JLabel label;
    private AttributedString as;
    public LabelExample()
    {
      as = new AttributedString("Ten to the fifth is 105");
      as.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, 22, 23);
      label = new JLabel(as);
      //the above line doesn't accept AttributedString 
      //as a suitable constructor
      this.add(label);
    }
    public void run()
    {
      setSize(500, 500);
      setVisible(true);
    }
    public static void main(String[] args)
    {
      LabelExample e = new LabelExample();
      javax.swing.SwingUtilities.invokeLater(e);
    }
  } 
  </code></pre>