zondag 27 maart 2011

[Java] changing font size of JLabel


Change the fontsize of a jLabel.


Here's a very short example on how to change the size in a jLabel.

Of course, to do this, you'll have to include the Font class.
Code:
import java.awt.Font;

Here's the short code to change only the size!
Code:
Font curFont = myLabel.getFont();
myLabel.setFont(new Font(curFont.getFontName, curFont.getStyle, 18));




@Qkyrie

2 opmerkingen:

  1. I think you meant "import" when you wrote "include" ;)
    Too much C/C++ for you!

    BeantwoordenVerwijderen
  2. Haha, so true, thanks for the comment ;)

    BeantwoordenVerwijderen