GUI Font - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

GUI Font

mabsmabs Posts: 18Member
How do i make the font larger using Graphics Class and Graphics2D class?

Thanks!

Comments

  • zibadianzibadian Posts: 6,349Member
    : How do i make the font larger using Graphics Class and Graphics2D class?
    :
    : Thanks!
    :
    You can use the getFont() to retrieve the Font object. Then using the deriveFont(int style, float size) that font can be replaced with a larger font. I'm not sure about the values of size, but with experimentation you can find out which value you need for your program. Example:
    [code]
    Font f = graphics.getFont();
    f = f.deriveFont(f.getStyle(), 2*f.getSize()); // Double the font size.
    // graphics.setFont(f); <= this is possibly necessary to complete the changes.
    [/code]


Sign In or Register to comment.