简体   繁体   English

Swing中的JLabel调整

[英]JLabel Adjustment in Swing

I tried following 我尝试了以下

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);

I get this 我明白了

在此处输入图片说明

But I want spacing between the Labels like 10px or something like this. 但是我想要标签之间的间距,例如10px或类似的东西。 What Layout / HTML would you suggest ? 您会建议使用哪种布局/ HTML?

What about using 'br' inside <> yes that what you need to leave a line 在<>中使用'br'怎么办,是的,您需要留下一行

Maybe the answer you need How to set line spacing/height in a JLabel in Java Swing? 也许您需要的答案如何在Java Swing中的JLabel中设置行距/高度?

Take a look here to see how HTML and Java works as one 看看这里查看HTML和Java是如何工作的一个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM