3
現在,我知道,在JButton文本中可以實現不同的字體系列。 Like belowJButton文本具有不同的CUSTOM字體
JButton button = new JButton("<html><font face=Arial>Hello </font><font face=Verdana>World</font></html>");
看起來像這樣。與Arial合作的「Hello」與Verdana合作的「World」。
但是,如果我想一個字有我一直在使用Font.createFont()
方法創建的字體是什麼。我認爲,像這樣的東西本來可以奏效。
Font myFont = createMyFont();
JButton button = new JButton("<html><font face=MyFont>Hello </font>World</html>");
這個問題的意義在於,我創建一個多語種的軟件,它在一個單一的JButton
兩種字體。
所以,我希望我的JButton
是這樣的:
但是,它是這樣的:
的Javadoc提到使用'Font.registerFont()'創建使用'Font.createFont()的字體後' –
嘗試註冊的字體: 'GraphicsEnvironment中GE = GraphicsEnvironment.getLocalGraphicsEnvironment(); \t ge.registerFont(myFont);' –
然後,我應該叫什麼名字?用它的文件名? – Akshat