Styled text in Swing
May 28th, 2004
Just discovered (although it feels that I may have known this before, I've just forgotten about it): how to get colors in your Swing components? Just treat your strings as HTML!
new JTree(new String[]{"<html><font color='red'>O</font><font color='blue'>n</font><font color='green'>e</font></html>", "Two"});
gives you
Now ain't that beautiful ?

April 21st, 2008 at 10:17 PM Unfortunately it's just coincidence if the default font (including size) is the same for both HTML and plain labels.