コード例 #1
0
 public void setBackground(Color color) {
   super.setBackground(color);
   // Are these settings the same as before?
   if (backgroundImage == null && gradientColors == null && gradientPercents == null) {
     if (color == null) {
       if (background == null) return;
     } else {
       if (color.equals(background)) return;
     }
   }
   background = color;
   backgroundImage = null;
   gradientColors = null;
   gradientPercents = null;
   redraw();
 }
コード例 #2
0
 /**
  * Sets the receiver's background color to the color specified by the argument, or to the default
  * system color for the control if the argument is null.
  *
  * <p>Note: This operation is a hint and may be overridden by the platform. For example, on
  * Windows the background of a Button cannot be changed.
  *
  * @param color the new color (or null)
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 @Override
 public void setBackground(Color color) {
   background = color;
   super.setBackground(getBackground());
   redraw();
 }