Use resource font directly in Java
1 answer
To load a font (.ttf) from a file, see Load font from ttf file .
Key lines:
InputStream is = DemoFonts.class.getResourceAsStream(fName);
font = Font.createFont(Font.TRUETYPE_FONT, is);
The font can then be used for JLabel
using the usual method setFont
.
+3
source to share