I am going to use my own font in my application. For this, I use the Font.createFont() method. My code is below. It works great when I run my main class with the command
java myAppl.class
The font file is in the same directory as in my class file. But when I linked all the files and font files in the JAR and then launched the application from the JAR, the custom font did not load. Why?
InputStream is = this.getClass().getResourceAsStream("myfont.TTF"); uniFont=Font.createFont(Font.TRUETYPE_FONT,is); Font f = uniFont.deriveFont(24f);
What should I do?
parag source share