public class ColorSampleButton extends ButtonGuiImpl
ColorChooserGuiImpl
dialog that displays a certain color allows
to quickly select it. There are three kind of instances of this class:
Modifier and Type | Field and Description |
---|---|
private int |
rgbColor
The color currently assigned to this button, in RGB color space.
|
private boolean |
selectable
The
selectable property. |
private boolean |
settable
Whether this color can be changed.
|
cc, DOT_LINE_WIDTH, gd, gf
config, widgetFocused
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
ColorSampleButton(int rgbColor)
This constructor creates a button configured with a color.
|
Modifier and Type | Method and Description |
---|---|
void |
draw()
Draw the button.
|
boolean |
focusTraversable()
Check if widget is focus traversable.
|
int |
getRgbColor()
Obtain the currently selected color.
|
double |
height()
Get widget height.
|
boolean |
isCustom()
Checks whether this is a custom color button.
|
void |
setRgbColor(int newColor)
Sets the color assigned to this button.
|
void |
setSelectable(boolean selectable)
Sets the
selectable property. |
void |
setSettable(boolean settable)
Sets the
settable property. |
static java.lang.String |
toHexString(int rgbColor)
Utility method for obtaining the 6 digits string of a RGB encoding value.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
double |
width()
Get widget width.
|
afterConfigUpdate, createMnemonic, getImgDisabled, getImgDown, getImgUp, handleBasicEvents, handleCursorKeys, hasImages, hasPrepackagedImages, highlighted, initialize, isAutoResize, isDefaultButton, isDroppable, isFocusable, isMnemonicSupported, isPressed, loadImage, mouseClicked, onFocusLost, physicalBounds, processMnemonic, refresh, requestFocus, setActionCode, setImage, supportsCustomMousePointer, 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 int rgbColor
private boolean selectable
selectable
property. Action buttons are selectable. The preview is not.private boolean settable
public ColorSampleButton(int rgbColor)
rgbColor
- The color assigned to this button, in RGB color space.public static java.lang.String toHexString(int rgbColor)
rgbColor
- The color, in RGB encoding.public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class ButtonGuiImpl
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 setRgbColor(int newColor)
newColor
- The new color to be assigned to this button.public void setSelectable(boolean selectable)
selectable
property. Action buttons (basic and custom colors) are
selectable. The preview is not.selectable
- The new value for selectable
property of this button.public void setSettable(boolean settable)
settable
property. Only custom colors and preview are settable. The
basic colors buttons are not.settable
- The new value for settable
property of this button.public java.lang.String toString()
toString
in class ButtonGuiImpl
public int getRgbColor()
public boolean isCustom()
true
only for custom color button.public boolean focusTraversable()
focusTraversable
in interface Widget<GuiOutputManager>
focusTraversable
in class ButtonGuiImpl