0

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

enter image description here

But I want spacing between the Labels like 10px or something like this. What Layout / HTML would you suggest ?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Junaid
  • 2,572
  • 6
  • 41
  • 77
  • I'd either use a single HTML table in a single `JLabel` or alternately for a collection of controls - `GroupLayout` as seen in [this answer](http://stackoverflow.com/a/21659516/418556). – Andrew Thompson Feb 11 '15 at 23:02
  • BTW - for spacing between the labels, change `new GridLayout(0,1)` to something like `new GridLayout(0,1,10,10)`.. – Andrew Thompson Feb 14 '15 at 08:02

1 Answers1

1

What about using 'br' inside <> yes that what you need to leave a line

Maybe the answer you need How to set line spacing/height in a JLabel in Java Swing?

Take a look here to see how HTML and Java works as one

Community
  • 1
  • 1
crAlexander
  • 376
  • 1
  • 2
  • 12