public class GamutPicker extends ButtonGuiImpl
ColorChooserGuiImpl
dialog that allows to view and select with
the mouse the HUE and SATURATION of a color. The LUMINOSITY/VALUE is completely ignored.Modifier and Type | Field and Description |
---|---|
private ImageWrapper<java.awt.image.BufferedImage> |
background
The colored background of the picker.
|
private int |
hue
The currently selected HUE.
|
private boolean |
imgLoaded
Flags whether we have already tried to load the bundle images.
|
private int |
NATIVE_HEIGHT
Constant representing the height (including one-pixel width border) of the widget.
|
private int |
NATIVE_WIDTH
Constant representing the width (including one-pixel width border) of the widget.
|
private ImageWrapper<java.awt.image.BufferedImage> |
pointer
The pointer of the selected color on the picker.
|
private int |
sat
The currently selected SATURATION.
|
cc, DOT_LINE_WIDTH, gd, gf
config, widgetFocused
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
GamutPicker()
This constructor instantiate and initialize the object.
|
Modifier and Type | Method and Description |
---|---|
void |
draw()
Draw the picker widget.
|
boolean |
focusTraversable()
Check if widget is focus traversable.
|
double |
height()
Get widget height.
|
static ImageWrapper<java.awt.image.BufferedImage> |
loadImage(java.lang.String imagePath)
Utility method for loading a resource bundle.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
selectValue(int hue,
int sat)
Sets a combination of HUE and SATURATION as the selected value of the picker.
|
double |
width()
Get widget width.
|
afterConfigUpdate, createMnemonic, getImgDisabled, getImgDown, getImgUp, handleBasicEvents, handleCursorKeys, hasImages, hasPrepackagedImages, highlighted, initialize, isAutoResize, isDefaultButton, isDroppable, isFocusable, isMnemonicSupported, isPressed, loadImage, onFocusLost, physicalBounds, processMnemonic, refresh, requestFocus, setActionCode, setImage, supportsCustomMousePointer, toString, updateSize, updateSizeWorker
isMouseOver, mouseActions, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased
addListener, checkKey, config, destroy, getColon, getColumnLabelText, getCommand, getLabelInstance, getLabelText, getMnemonic, getTo, initButtonText, isForceLabel, isNoLabels, isRightAligned, postprocessConfig, processEvent, processKeyEvent, setCommand, setHidden, setLabelInstance, setMnemonic, setNoLabels, setSupportsMnemonic, setText, setTextLabel, setVisible, setWasVisible, textLabel, wasVisible
dimension, forceCursorOnFocus, getDefaultEvent, ignoreAction, manageSystemActions, minimumSize, onFocusGained, onKeyPressed, onKeyTyped, processKeyEventCommon
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, insets, isCurrent, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalDimension, physicalLocation, prepParentLocation, processDirectManipulationEvent, processFocusEvent, processKeyListeners, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, showPopupMenu, sync, topLevelWindow, translate, unrealize, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, dimension, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, insets, isCurrent, isDirectManipulable, isDisplayed, isEnabled, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalDimension, physicalLocation, processDirectManipulationEvent, processFocusEvent, processKeyListeners, raiseLegacyMouseEvents, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, topLevelWindow, unrealize, window
getColumnMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, setColumnMnemonic, updateMnemonic
private final int NATIVE_HEIGHT
private final int NATIVE_WIDTH
private boolean imgLoaded
private ImageWrapper<java.awt.image.BufferedImage> background
null
, the widget was not yet displayed or
load of the image has failed.private ImageWrapper<java.awt.image.BufferedImage> pointer
null
, the widget was not yet
displayed or load of the image has failed.private int hue
NATIVE_WIDTH
- 2) to
represent the location on the screen of the selected color (as opposed 0 - 240 interval used
by the ColorChooserGuiImpl
and ColorRgb
).private int sat
NATIVE_HEIGHT
- 2) to represent the location on the screen of the selected color (as opposed 0 - 240
interval used by the ColorChooserGuiImpl
and ColorRgb
).public GamutPicker()
public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class ButtonGuiImpl
public static ImageWrapper<java.awt.image.BufferedImage> loadImage(java.lang.String imagePath)
Theme
class to open the resource input stream.imagePath
- The path of the image to be loaded.ImageWrapper
container object or
null
if loading or decoding of image failed.public double height()
height
in interface Widget<GuiOutputManager>
height
in class ButtonGuiImpl
public double width()
width
in interface Widget<GuiOutputManager>
width
in class ButtonGuiImpl
public void selectValue(int hue, int sat)
hue
- New HUE value. Must be in 0-240 interval.sat
- New SATURATION value. Must be in 0-240 interval.public void mouseClicked(java.awt.event.MouseEvent e)
Button.command
is updated so that the action event emitted by super class will
bear the new selected HUE/SAT combination.mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class ButtonGuiImpl
e
- The mouse event.public boolean focusTraversable()
focusTraversable
in interface Widget<GuiOutputManager>
focusTraversable
in class ButtonGuiImpl
true
because this widget is NOT focus traversable.