Here you can find the source of getForegroundColor(JTextPane textPane)
public static Color getForegroundColor(JTextPane textPane)
//package com.java2s; //License from project: Apache License import java.awt.Color; import javax.swing.JTextPane; import javax.swing.text.StyleConstants; public class Main { /**/*from w w w . j a v a2 s . co m*/ * Returns the current foreground color. */ public static Color getForegroundColor(JTextPane textPane) { Color color = (Color) (textPane.getInputAttributes() .getAttribute(StyleConstants.Foreground)); if (color == null) { color = new Color(0, 0, 0); } return color; } }