开发者

Best way to add a String in a JFrame

开发者 https://www.devze.com 2022-12-16 01:12 出处:网络
which is the best way to add format开发者_运维知识库ed string in jframe. Previously I was trying to add jlabel If you want to display some text in a window, yes, adding a JLabel to your JFrame is fine

which is the best way to add format开发者_运维知识库ed string in jframe. Previously I was trying to add jlabel


If you want to display some text in a window, yes, adding a JLabel to your JFrame is fine.

Just create an instance of the font you want and assign it to the JLabel using setFont.

Here is a code samle (taken from here):

Font font = new Font("Jokerman", Font.PLAIN, 35);
JLabel textLabel = new JLabel(textMessage);
textLabel.setFont(font);
0

精彩评论

暂无评论...
验证码 换一张
取 消