try below
editorPane.setFont(new Font("Segoe UI", Font.PLAIN, 24));
below is working code:
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
public class jeditorfont extends JFrame {
private JTextPane textPane = new JTextPane();
public jeditorfont() {
super();
setSize(300, 200);
textPane.setFont(new Font("Segoe UI", Font.PLAIN, 24));
// create some handy attribute sets
SimpleAttributeSet red = new SimpleAttributeSet();
StyleConstants.setForeground(red, Color.red);
StyleConstants.setBold(red, true);
SimpleAttributeSet blue = new SimpleAttributeSet();
StyleConstants.setForeground(blue, Color.blue);
SimpleAttributeSet italic = new SimpleAttributeSet();
StyleConstants.setItalic(italic, true);
StyleConstants.setForeground(italic, Color.orange);
// add the text
append("NULL ", null);
append("Blue", blue);
append("italic", italic);
append("red", red);
Container content = getContentPane();
content.add(new JScrollPane(textPane), BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
protected void append(String s, AttributeSet attributes) {
Document d = textPane.getDocument();
try {
d.insertString(d.getLength(), s, attributes);
} catch (BadLocationException ble) {
}
}
public static void main(String[] args) {
new jeditorfont().setVisible(true);
}
}
ref: http://www.java2s.com/Code/JavaAPI/javax.swing/JTextPanesetFontFontfont.htm