I was previously working on web and there for using a Google Font I can simple add the link for that and use it in CSS. Now I'm working in javax.swing
. I want to use a Google Font which I selected in JTextPane. I have downloaded the font and how do I set the font to the downloaded font?
Asked
Active
Viewed 47 times
1

Andrew Thompson
- 168,117
- 40
- 217
- 433

Ruthvik
- 790
- 5
- 28
-
3Does this help? [Adding fonts to Swing application and include in package](https://stackoverflow.com/questions/12998604/adding-fonts-to-swing-application-and-include-in-package) – Abra Oct 19 '21 at 05:11
-
1Using custom fonts, for [example](https://stackoverflow.com/questions/24177348/font-awesome-with-swing/24177458#24177458); [example](https://stackoverflow.com/questions/21081586/using-a-custom-font-for-a-jlabel/21081821#21081821); [example](https://stackoverflow.com/questions/24278648/how-to-change-font-in-java-gui-application/24278825#24278825). But I suspect getting it to actually work with `JTextPane` might be a little more involved – MadProgrammer Oct 19 '21 at 05:14
-
1[Google](https://www.google.com/search?client=safari&rls=en&q=jtextpane+custom+font&ie=UTF-8&oe=UTF-8) has a number of possible useful examples as well – MadProgrammer Oct 19 '21 at 05:17