+ /**
+ * Note: this class supports NULL as a background color, which will revert
+ * it to its default state.
+ * <p>
+ * Note: this class' implementation will also set the main pane background
+ * color at the same time.
+ * <p>
+ * Sets the background color of this component. The background color is used
+ * only if the component is opaque, and only by subclasses of
+ * <code>JComponent</code> or <code>ComponentUI</code> implementations.
+ * Direct subclasses of <code>JComponent</code> must override
+ * <code>paintComponent</code> to honor this property.
+ * <p>
+ * It is up to the look and feel to honor this property, some may choose to
+ * ignore it.
+ *
+ * @param bg
+ * the desired background <code>Color</code>
+ * @see java.awt.Component#getBackground
+ * @see #setOpaque
+ *
+ * @beaninfo preferred: true bound: true attribute: visualUpdate true
+ * description: The background color of the component.
+ */
+ @Override
+ public void setBackground(Color backgroundColor) {
+ Color cme = backgroundColor == null ? backgroundColorDef
+ : backgroundColor;
+ Color cpane = backgroundColor == null ? backgroundColorDefPane
+ : backgroundColor;
+
+ if (pane != null) { // can happen at theme setup time
+ pane.setBackground(cpane);
+ }
+ super.setBackground(cme);
+ }
+