java 更改 JLabel 的字体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7859551/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 21:43:57 来源:igfitidea点击:
Change font of JLabel
提问by hudi
how to change Font of JLabel ? I try this but with no succes:
如何更改 JLabel 的字体?我试过这个,但没有成功:
JLabel nadpis = new JLabel();
nadpis.setFont(new Font("Papyrus", Font.ITALIC, 100));
nadpis.setText("hi");
Just size is changed but Font is still same
只是大小改变了,但字体仍然相同
采纳答案by Andrew Thompson
I didn't see papyrus in my available fonts. How can I add it?
我没有在可用字体中看到纸莎草纸。我怎样才能添加它?
Look in the Font
methodsfor the createFont()
variants.
看在Font
方法的createFont()
变体。