2

I have an CMS application which is written using C#, and I should Save FONT's as VARCHAR in a Database. Then I should get the specified FONT from a Java Application.

So how is possible to set a Font to a JLabel or a Font Object using String.

For example, I have a String which Contains Font Type, Size and Name:

Type:Bold Size:12 Name:Microsoft Sans Serif

So how should I convert the typed String to Font in Java?

Jon Egeland
  • 12,470
  • 8
  • 47
  • 62
Rosmarine Popcorn
  • 10,761
  • 11
  • 59
  • 89

1 Answers1

5
JLabel.setFont(Font.decode("fontname-style-pointsize"))

http://download.oracle.com/javase/1.5.0/docs/api/java/awt/Font.html#decode%28java.lang.String%29

PeterMmm
  • 24,152
  • 13
  • 73
  • 111