But when I wanted to paint my own (multi-color) background in a subclass of JLabel, the sizing didn't work properyly.
Painting a background would have nothing to do with that.
I believe the background is painted in ComponentUI.update(...)
If you look in the BasicLabelUI you will see code like:
If you look in the BasicPanelUI you will see code like:
So all components share the same background painting code (unless it is overridden somewhere) and the opaque property controls the painting of the background.