I have a JLabel with text in it, and I want to add another piece of text to it, but the latter will have a different color than the first (for example, red). I tried:
statusLabel.setText(statusLabel.getText() + " <html><span style\"color: red\">" + message + "</span></html>");
But that will not work. It simply displays HTML tags but does not display them. Any suggestions? Is it possible to change the color of some text in JLabel?
source share