OverviewSingleDeprecated

jsx3.gui

class ColorPicker

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Painted
      ->jsx3.gui.Block
        ->jsx3.gui.ColorPicker

All Implemented Interfaces:

jsx3.gui.Form, jsx3.gui.Interactive, jsx3.util.EventDispatcher

class ColorPicker
extends jsx3.gui.Block
A GUI class that allows the user to pick a color using an HSB (hue-saturation-brightness) picker.

Since:

3.2

Field Summary
static int
BRIGHTNESS
Value for the axis property indicating a brightness axis.
static int
DEFAULT_HEIGHT
The default rendered height of this control if no height is specified.
static int
DEFAULT_WIDTH
The default rendered width of this control if no width is specified.
static int
HUE
Value for the axis property indicating a hue axis.
static int
SATURATION
Value for the axis property indicating a saturation axis.
Constructor Summary
void
init(strName : String, vntLeft : int | String, vntTop : int | String, vntWidth : int, vntHeight : int)
The instance initializer.
Method Summary
static Array<int>
HSBtoRGB(h : float, s : float, l : float)
Converts HSB color components to RGB components.
static Array<int>
RGBtoHSB(r : int, g : int, b : int)
Converts RGB color components to HSB components.
int
int
int
Returns the RGB value of the currently selected color as an integer.
int
Returns the RGB value of the currently selected color as an integer.
String
Returns the HTML to render this control.
jsx3.gui.ColorPicker
setAxis(intAxis : int)
Sets the color axis shown on the right side of the control.
void
setHSB(h : float, s : float, b : float)
Sets the currently selected color by HSB components.
void
setRGB(rgb : int)
Sets the currently selected color by RGB.
void
setValue(strValue : int | String)
Sets the RGB value of this color picker.
Methods Inherited From jsx3.gui.Form
doKeyBinding, doReset, getDisabledBackgroundColor, getDisabledColor, getEnabled, getKeyBinding, getRequired, getValidationState, setDisabledBackgroundColor, setDisabledColor, setEnabled, setKeyBinding, setRequired, setValidationState
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCSSOverride, getClassName, getColor, getCursor, getDimensions, getDisplay, getFontName, getFontSize, getFontWeight, getHeight, getIndex, getLeft, getMargin, getOverflow, getPadding, getRelativePosition, getTagName, getText, getTextAlign, getTip, getTop, getVisibility, getWidth, getZIndex, hideMask, setBackground, setBackgroundColor, setBorder, setCSSOverride, setClassName, setColor, setCursor, setDimensions, setDisplay, setFontName, setFontSize, setFontWeight, setHeight, setIndex, setLeft, setMargin, setOverflow, setPadding, setRelativePosition, setTagName, setText, setTextAlign, setTip, setTop, setVisibility, setWidth, setZIndex, showMask
Methods Inherited From jsx3.gui.Interactive
doEvent, getCanDrag, getCanDrop, getCanMove, getCanSpy, getEvent, getEvents, getMenu, hasEvent, registerHotKey, removeEvent, removeEvents, setCanDrag, setCanDrop, setCanMove, setCanSpy, setEvent, setMenu, setSpyStyles, showSpy
Methods Inherited From jsx3.gui.Painted
focus, getAbsolutePosition, getAttribute, getAttributes, getDynamicProperty, getRendered, insertHTML, onAfterPaint, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute, setDynamicProperty
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

BRIGHTNESS

static final int BRIGHTNESS
Value for the axis property indicating a brightness axis.

DEFAULT_HEIGHT

static int DEFAULT_HEIGHT
The default rendered height of this control if no height is specified.

DEFAULT_WIDTH

static int DEFAULT_WIDTH
The default rendered width of this control if no width is specified.

HUE

static final int HUE
Value for the axis property indicating a hue axis.

SATURATION

static final int SATURATION
Value for the axis property indicating a saturation axis.
Constructor Detail

init

void init(strName : String, vntLeft : int | String, vntTop : int | String, vntWidth : int, vntHeight : int)
The instance initializer.

Parameters:

strName
vntLeft
vntTop
vntWidth
vntHeight
Method Detail

HSBtoRGB

static Array<int> HSBtoRGB(h : float, s : float, l : float)
Converts HSB color components to RGB components.

Parameters:

hThe hue component, [0.0, 1.0].
sThe saturation component, [0.0, 1.0].
lThe brightness component, [0.0, 1.0].

Returns:

[r, g, b]. Each component is an integer [0, 255].  

RGBtoHSB

static Array<int> RGBtoHSB(r : int, g : int, b : int)
Converts RGB color components to HSB components.

Parameters:

rThe red component, [0, 255]. If only one parameter is passed, this parameter may be a 24-bit integer of the form 0xRRGGBB.
gThe green component, [0, 255].
bThe blue component, [0, 255].

Returns:

[h, s, b]. Each component is a float [0.0, 1.0].  

doValidate

int doValidate()

Returns:

always jsx3.gui.Form.STATEVALID.  

Overrides:

doValidate in jsx3.gui.Form

getAxis

int getAxis()

Returns:

HUE, SATURATION, or BRIGHTNESS.  

getRGB

int getRGB()
Returns the RGB value of the currently selected color as an integer. The return value is a 24-bit number of the form 0xRRGGBB.

Returns:

 

getValue

int getValue()
Returns the RGB value of the currently selected color as an integer. The return value is a 24-bit number of the form 0xRRGGBB.

Returns:

 

Overrides:

getValue in jsx3.gui.Form

paint

String paint()
Returns the HTML to render this control.

Returns:

 

Overrides:

paint in jsx3.gui.Block

setAxis

jsx3.gui.ColorPicker setAxis(intAxis : int)
Sets the color axis shown on the right side of the control. The other two axes are displayed in a box on the left side.

Parameters:

intAxisHUE, SATURATION, or BRIGHTNESS.

Returns:

 

See Also:

HUE, SATURATION, BRIGHTNESS

setHSB

void setHSB(h : float, s : float, b : float)
Sets the currently selected color by HSB components.

Parameters:

hThe hue component, [0.0, 1.0].
sThe saturation component, [0.0, 1.0].
bThe brightness component, [0.0, 1.0].

setRGB

void setRGB(rgb : int)
Sets the currently selected color by RGB. The view is updated to reflect the change in value.

Parameters:

rgba 24-bit integer of the form 0xRRGGBB.

setValue

void setValue(strValue : int | String)
Sets the RGB value of this color picker.

Parameters:

strValuethe supported formats are: RGB integer value as number or string and HTML hex code, "#000000".

Overrides:

setValue in jsx3.gui.Form