Here you can find the source of getTextPaneLabel(JScrollPane jsp, Color textColor)
public static JTextPane getTextPaneLabel(JScrollPane jsp, Color textColor)
//package com.java2s; //License from project: LGPL import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JScrollPane; import javax.swing.JTextPane; public class Main { public static JTextPane getTextPaneLabel(JScrollPane jsp, Color textColor) { JTextPane textPane = new JTextPane(); textPane.setOpaque(false);//from w w w . jav a2 s . c om textPane.setEditable(false); //textPane.setEnabled(false); textPane.setDisabledTextColor(textColor); if (jsp != null) { jsp.setViewportView(textPane); jsp.setBorder(BorderFactory.createEmptyBorder()); } return textPane; } }