Java JTextPane getFontFamily(JTextPane textPane)

Here you can find the source of getFontFamily(JTextPane textPane)

Description

Returns the font family of the current character.

License

Apache License

Declaration

public static String getFontFamily(JTextPane textPane) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.swing.JTextPane;

import javax.swing.text.StyleConstants;

public class Main {
    /**//from w  w w . ja  va  2 s.  com
     * Returns the font family of the current character.
     */
    public static String getFontFamily(JTextPane textPane) {
        String family = (String) (textPane.getInputAttributes()
                .getAttribute(StyleConstants.FontFamily));
        return family;
    }
}

Related

  1. appendToPane(JTextPane textPane, String text, Color foregroundColor, Color backgroundColor)
  2. applyRegex(String regex, JTextPane pane, Color highlightColor)
  3. centerText(JTextPane pane)
  4. createJTextPane(String text, Color backgroundColor)
  5. createTextPaneScrollPane(JTextPane textPane)
  6. getForegroundColor(JTextPane textPane)
  7. insertStyledString(JTextPane textPane, String text, SimpleAttributeSet attrSet, Color background, Color foreground, String fontFamily, int fontSize, boolean bold, boolean italic, boolean underline, boolean strikeThrough, Boolean superscript)
  8. isSelectionBold(JTextPane textPane)
  9. overrideStyle(String styleName, JTextPane textPane, Style newStyle)