/F...">

Why doesn't JLabel display '/' when it's the first character?

I have a panel with JLabel inside. JLabel looks like this:

new JLabel("<html>/Foo <br/>/Bar <br/>/Foo<br/>/Bar</html>");

However, it is displayed in the user interface as follows:

Bar

Foo

Bar

For some reason, the first line just disappears. If I cross out the slash or remove the html tags, it works as expected. Is there a way to make the first line with a slash? The reason for this is even because we have JLabels that are populated with third-party data. I could programmatically remove the slash, but I would prefer to show it in the user interface if there is a way to do this. We use html and BR tags to make sure each value is on its own line.

+5
2

, . , :

"<html><body>/Foo <br/>/Bar <br/>/Foo<br/>/Bar</body></html>"
+7

. .

+5

All Articles