CLabel.setBackground

Specify a gradient of colours to be drawn in the background of the CLabel. <p>For example, to draw a gradient that varies from dark blue to white in the vertical, direction use the following call to setBackground:</p> <pre> clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_WHITE)}, new int[] {100}, true); </pre>

@param colors an array of Color that specifies the colors to appear in the gradient in order of appearance from left/top to right/bottom; The value <code>null</code> clears the background gradient; the value <code>null</code> can be used inside the array of Color to specify the background color. @param percents an array of integers between 0 and 100 specifying the percent of the width/height of the widget at which the color should change; the size of the percents array must be one less than the size of the colors array. @param vertical indicate the direction of the gradient. True is vertical and false is horizontal.

@exception SWTException <ul> <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> <li>ERROR_INVALID_ARGUMENT - if the values of colors and percents are not consistent</li> </ul>

@since 3.0

  1. void setBackground(Color[] colors, int[] percents)
  2. void setBackground(Color[] colors, int[] percents, bool vertical)
    class CLabel
    void
    setBackground
    ()
  3. void setBackground(Image image)

Meta