Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Custom font doesn't want to change size

843805Dec 6 2006 — edited Dec 6 2006
I declare proggytiny as a protected static Font in my class, then initialize it as follows:
		try {
		proggytiny = Font.createFont(
				  Font.TRUETYPE_FONT, GECKO_SE.class.getResourceAsStream("fonts/ProggyTiny.ttf"));
		} catch(FontFormatException e) {
			System.out.println("Font format not supported");
		} catch (IOException e) {
			System.out.println("Font not found");
		}
I then use setFont on a ]b]JTextPane to apply this font to it.

The JTextPane then seemingly has no text on it, but in fact a tiny flashing dot appears for the cursor when I click on a line. I printed out a proggyfont.getSize(), and its size is currently '1', which is either the problem or a symptom of a larger problem, I'm assuming.

My question is this: how can I set the size of my custom font? I've been searching for about 90 minutes and haven't found anything that works; the first thing I tried was
proggyfont = proggyfont.deriveFont(12);
after initializing it, but it's had no effect.

Help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2007
Added on Dec 6 2006
3 comments
281 views