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!

Font - createFont & drawString

843807Oct 25 2006 — edited Oct 29 2006
I'm trying to load a TrueType Font & use that font in a TitleBorder and various other places (sometimes in AWT or Swing components, sometimes just by calling drawString).

I'm able to load the Font successfully but it is not being painted successfully. In other words, the font that is being drawn is NOT the font that I created.

Is there a problem with using Fonts and calling drawString on that Font? Even when using that Font with Swing components?

TITLE_FONT = Font.createFont(Font.TRUETYPE_FONT,new File("KABELN.TTF"));
LineBorder lineBorder = new LineBorder(TITLE_COLOR);
TitledBorder titleBorder = BorderFactory.createTitledBorder(
lineBorder,"My Title",TitledBorder.LEFT, TitledBorder.ABOVE_TOP,
TITLE_FONT, TITLE_COLOR);

ARG! It is not using the Kabel font for the title of my border

I'm using 1.5.0_04-b05

Any ideas? Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 26 2006
Added on Oct 25 2006
2 comments
162 views