title: Make JTextPane background transparent
body: <p>I have created my own Label class which has the advantage of being copyable. </p>
  
  <pre><code>public class CopyableLabel extends JTextPane {
  
  private static final long serialVersionUID = -1;
  
  private static final Font DEFAULT_FONT;
  
  static 
  {
      Font font = UIManager.getFont("Label.font");
      DEFAULT_FONT = (font != null) ? font: new Font("Tahoma", Font.PLAIN, 11);
  }
  
  public CopyableLabel() {
      construct();
  }
  
  private void construct()
  {
      setContentType("text/html");
  
      setEditable(false);
      setOpaque(false);
      setBackground(null);
      setBorder(null);
  
      putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
      setFont(DEFAULT_FONT);
  }
  
  public CopyableLabel(String text)
  {
      super();
      construct();
      setText(text);
  }
  
  public void setFont(Font font)
  {
      super.setFont(font);
      setMaximumSize(new Dimension(Short.MAX_VALUE,font.getSize()+4));
  }
  
  public CopyableLabel(String title, int align) 
  {
      super();
      construct();
      setText(title);
  
      StyledDocument doc = getStyledDocument();
      SimpleAttributeSet center = new SimpleAttributeSet();
      StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
      switch(align)
      {
          case JLabel.LEFT:
              StyleConstants.setAlignment(center, StyleConstants.ALIGN_LEFT);
              break;
          case JLabel.RIGHT:
              StyleConstants.setAlignment(center, StyleConstants.ALIGN_RIGHT);
              break;
      }
      doc.setParagraphAttributes(0, doc.getLength(), center, false);
  }
  </code></pre>
  
  <p>The problem is, that with Nimbus Look and Feel the white background is looking ugly. So I look for a possibility to get the background transparent.</p>
  
  <p>Do you have any solution?</p>