javax.swing.JLabel subclass which supports
org.jdesktop.swingx.painter.Painters, multi-line text,
and text rotation.
Painter support consists of the
backgroundPainter properties. The
backgroundPainter refers to a painter responsible for painting beneath the text and icon. This
painter, if set, will paint regardless of the
opaque property. If the background painter does not
fully paint each pixel, then you should make sure the
opaque property is set to false.
foregroundPainter is responsible for painting the icon and the text label. If no foregroundPainter
is specified, then the look and feel will paint the label. Note that if opaque is set to true and the look and feel
is rendering the foreground, then the foreground may paint over the background. Most look and feels will
paint a background when
opaque is true. To avoid this behavior, set
opaque to false.
Since JXLabel is not opaque by default (
isOpaque() returns false), neither of these problems
typically present themselves.
Multi-line text is enabled via the
lineWrap property. Simply set it to true. By default, line wrapping
occurs on word boundaries.
The text (actually, the entire foreground and background) of the JXLabel may be rotated. Set the
rotation property to specify what the rotation should be. Specify rotation angle in radian units.