Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Change Label Text Size??

 
may tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HellOoo..

Is there a way to increase the text size on a label?
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a Font object with the font face and size that you need, then you can apply the font to the label using myLabel.setFont(myFont);

Cheers,
Rachel
 
may tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh ok.. but wad is the coding if i want to increase the size of e texts in the label??

and how i know what are e varoius size available in java??
like for example in html.. e size range frm 1 - 7.
so wad abt java??
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> but wad is the coding if i want to increase the size of e texts in the label??

look at the api docs for Font, and you'll find this constructor
public Font(String name,int style,int size)

and you would write it something like this
label.setFont(new Font("Lucida",Font.PLAIN,24)); //24 = size
 
may tan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.. i got it..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic