I’m trying to get a JLabel to display new line characters by using HTML tags. But the text I want is obtained from a method. Here’s the line of code:
myLabel.setText("<html><pre>myCart.toString()</pre></html>");
But, this literally sets the text of the label to myCart.toString(), not to the String that is returned by the method. Is there a way around this?
Do you mean?
or just:
since
toString()will be called implicitly.