- SWT provides a class called RGB that stores RGB values.
- RGB class holds the data that can represent a color.
- SWT provides a class called Color that represents an actual color.
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
public class ColorCreate {
public static void main(String[] args) {
Display display = new Display();
RGB rgb = new RGB(255, 0, 0); // pure red
Color color = new Color(display, rgb);
System.out.println(color.getBlue());
display.dispose();
}
}