Link to home
Start Free TrialLog in
Avatar of komlaaa
komlaaa

asked on

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)  );
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Try "Helvetica" for examle
SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
reportTitleLabel.setFont(  new Font("Helvetica", Font.ITALIC, 16)  );
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or reportTitleLabel.setFont(  new Font(Font.getFont(header).<u>getName()</u>, Font.ITALIC, 16)  );
sorry underline didn't work
If you want to use the font of another component but adapt the style + size:

reportTitleLabel.setFont( otherComponent.getFont().deriveFont(Font.ITALIC, 16) );
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)
Avatar of komlaaa
komlaaa

ASKER

get back to you tomorrow,... i am sleepy here ;)
nite :)
thanks