How to change the color of particular characters in JLabel? For instance,
JLabel lbl = new JLabel("My Text");
I would like that My
has blue color, while Text
has red color.
Is it possible?
Yes, check How to Use HTML in Swing Components.
JLabel lbl = new JLabel("<html><font color=blue>My</font><font color=red>Text</font></html>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With