In our Java Swing application, we\'re loading a custom font and adding it to a JLabel
:
try {
this.font = Font.createFont(Font.TRUETYPE_FONT, new F
To use some font:
<html><head><style type="text/css">
body { font-family: Cool; } </style></head><body>...
The Font you created has to be registered first in the singleton GraphicsEnvironment to be accessible to all:
GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
genv.registerFont(font);
Because StyledDocument extends Document, you may be able use an implementation thereof using JTextField
's setDocument() method.