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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.