gpt4 book ai didi

java - Swing中的JLabel调整

转载 作者:行者123 更新时间:2023-12-01 11:55:40 26 4
gpt4 key购买 nike

我尝试遵循

JPanel round1Score = new JPanel(new GridLayout(0,1));
JLabel accuracy = new JLabel("<html><div style=\"text-align: center; padding: 10px;\">Accuracy score _____ %</html>");
JLabel repeatibility = new JLabel("<html><div style=\"text-align: center; padding: 10px;\">Repeatibility score _____ %</html>");
JLabel classification = new JLabel("<html><div style=\"text-align: center; padding: 10px;\">You have been clasified as _____</html>");
JLabel tendency = new JLabel("<html><div style=\"text-align: center; padding: 10px;\">You have a tendency to _____</html>");

round1Score.add(accuracy);
round1Score.add(repeatibility);
round1Score.add(classification);
round1Score.add(tendency);

我明白了

enter image description here

但我希望标签之间的间距为 10px 或类似的值。您建议使用什么布局/HTML?

最佳答案

在里面使用“br”怎么样<>是的,你需要留下一行

也许您需要的答案How to set line spacing/height in a JLabel in Java Swing?

看看这里,看看 HTML 和 Java 是如何工作的 as one

关于java - Swing中的JLabel调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28461727/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com