Font

I can't get the font name right:
String header = "<html>[ Student Report Sheet ]<br>" +date.toString() + "</html>";
reportTitleLabel.setFont(  new Font(Font.getFont(header), Font.ITALIC, 16)  );
komlaaaAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
or better still use:

reportTitleLabel.setFont(  reportTitleLabel.getFont().deriveFont(Font.ITALIC, 16)  );
0
 
objectsCommented:
Try "Helvetica" for examle
0
 
zzynxConnect With a Mentor Software engineerCommented:
reportTitleLabel.setFont(  new Font("Verdana", Font.ITALIC, 16)  );
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
objectsCommented:
reportTitleLabel.setFont(  new Font("Helvetica", Font.ITALIC, 16)  );
0
 
StillUnAwareCommented:
or reportTitleLabel.setFont(  new Font(Font.getFont(header).<u>getName()</u>, Font.ITALIC, 16)  );
0
 
StillUnAwareCommented:
sorry underline didn't work
0
 
zzynxSoftware engineerCommented:
If you want to use the font of another component but adapt the style + size:

reportTitleLabel.setFont( otherComponent.getFont().deriveFont(Font.ITALIC, 16) );
0
 
objectsCommented:
you can get more details on the deriveFont() method I posted above at:

http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Font.html#deriveFont(int, float)
0
 
komlaaaAuthor Commented:
get back to you tomorrow,... i am sleepy here ;)
0
 
objectsCommented:
nite :)
0
 
zzynxSoftware engineerCommented:
thanks
0
All Courses

From novice to tech pro — start learning today.