Here you can find the source of createJTextPane(String text, Color backgroundColor)
JTextPane
object with the given properties.
Parameter | Description |
---|---|
text | The text which will appear in the text pane |
backgroundColor | The background color |
JTextPane
object
public static JTextPane createJTextPane(String text, Color backgroundColor)
//package com.java2s; import java.awt.Color; import java.awt.Font; import javax.swing.JTextPane; public class Main { /**//from www . j a v a2 s. c om * Creates a new <code>JTextPane</code> object with the given properties. * * @param text The text which will appear in the text pane * @param backgroundColor The background color * @return A <code>JTextPane</code> object */ public static JTextPane createJTextPane(String text, Color backgroundColor) { JTextPane jTextPane = new JTextPane(); jTextPane.setBorder(null); jTextPane.setEditable(false); jTextPane.setBackground(backgroundColor); jTextPane.setFont(new Font("Times New Roman", Font.PLAIN, 14)); if (text != null) { jTextPane.setText(text); } jTextPane.setVerifyInputWhenFocusTarget(false); jTextPane.setAutoscrolls(false); return jTextPane; } }