public class TrueTypeJokerman extends JFrame {
private String textMessage = "Java Internationalization";
public TrueTypeJokerman() {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.getAllFonts();
// Font font = new Font("Comic Sans MS", Font.PLAIN, 35);
// Font font = new Font("Times New Roman", Font.PLAIN, 35);
Font font = new Font("Helvetica", Font.ITALIC, 35);
JLabel textLabel = new JLabel(textMessage);
textLabel.setFont(font);
getContentPane().add(textLabel);
setVisible(true);
}
public static void main(String[] args) {
JFrame frame = new TrueTypeJokerman();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
}
public Font (java.lang.String name, int style, int size);
//name: 指的是字型名如Times New Roman,Helvetica(苹果),Verdana微软),黑体,隶书等
//style: 指的是黑体、粗体这类
//size: 指的是字体大小