【发布时间】:2014-06-22 23:56:30
【问题描述】:
当我尝试通过从 Font.createFont 返回的字体设置 JLabel 的字体时,JLabel 什么也不显示:
Font tempFont = Font.createFont(Font.TRUETYPE_FONT, new File("Path to a ttf font"));
Font font = tempFont.deriveFont(48);
JFrame frame = new JFrame();
JLabel text = new JLabel("Salam Jahan!");
text.setFont(font);
frame.getContentPane().add(text);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
有什么问题?
【问题讨论】: