2
* @(#)RGBColorSliderModel.java 1.0 May 22, 2005
4
* Copyright (c) 2005 Werner Randelshofer
5
* Staldenmattweg 2, Immensee, CH-6405, Switzerland.
8
* This software is the confidential and proprietary information of
9
* Werner Randelshofer. ("Confidential Information"). You shall not
10
* disclose such Confidential Information and shall use it only in
11
* accordance with the terms of the license agreement you entered into
12
* with Werner Randelshofer.
15
package org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser;
19
* A ColorSliderModel for RGB color components (red, green, blue).
21
* @author Werner Randelshofer
22
* @version 1.0 May 22, 2005 Created.
24
public class RGBColorSliderModel extends ColorSliderModel {
26
* Creates a new instance.
28
public RGBColorSliderModel() {
29
super(new DefaultBoundedRangeModel[] {
30
new DefaultBoundedRangeModel(255, 0, 0, 255),
31
new DefaultBoundedRangeModel(255, 0, 0, 255),
32
new DefaultBoundedRangeModel(255, 0, 0, 255)
38
return getRGB(components[0].getValue(), components[1].getValue(), components[2].getValue());
41
protected int getRGB(int r, int g, int b) {
42
return 0xff000000 | r << 16 | g << 8 | b;
46
public void setRGB(int rgb) {
47
components[0].setValue((rgb & 0xff0000) >> 16);
48
components[1].setValue((rgb & 0x00ff00) >> 8);
49
components[2].setValue( rgb & 0x0000ff);
53
public int toRGB(int[] values) {
54
return 0xff000000 | values[0] << 16 | values[1] << 8 | values[2];