
Don’t Settle for Boring Text Labels #2
Chapter 1, Basic JComponents
|
13
HACK
The shadow offsets let you effectively rearrange the letters to create a faded
3D effect (shown in Figure 1-10):
// 3d letters
label.setLeftShadow(5,5,Color.white);
label.setRightShadow(-3,-3, new Color(0xccccff));
label.setForeground(new Color(0x8888ff));
label.setFont(label.getFont( ).deriveFont(140f));
You could expand on this hack by combining it with images and nice gradi-
ents like the Christmas Countdown counter in Figure 1-11. Simple graphi-
cal effects like the ones shown in the
RichJLabel are easy to create with
Swing thanks to the power of Java2D, and they can really make your inter-
faces pop.
Figure 1-10. 3D faded letters
Figure 1-11. Mild emboss effect