JavaView© v3.95.000

jv.number
Class PuColorPicker

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjv.object.PsPanel
                  extended byjv.number.PuColorPicker
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, PsUpdateIf, java.io.Serializable

public class PuColorPicker
extends PsPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Panel with rainbow color wheel and RGB and brightness sliders. Use method #getColor to get the current color choice.

See Also:
PdColor_IP, PdColor_Dialog, Serialized Form

Field Summary
 
Fields inherited from class jv.object.PsPanel
BORDER_GROOVE, BORDER_LINE, BORDER_NONE, BORDER_SUNK, CONFIG, CONFIG_EXT, INFO, INFO_EXT, LABEL, LABEL_EXT, MATERIAL, MATERIAL_EXT, TEXTURE, TEXTURE_EXT, VECTOR, VECTOR_EXT
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PuColorPicker(java.awt.Color initColor)
          Create a new color inspector with color wheel for picking colors.
 
Method Summary
 java.awt.Color getColor()
          Get current color selection.
 java.awt.Color getDefColor()
          Get the default color.
 java.awt.Dimension getPreferredSize()
          Get preferred size of this panel for inclusion in other containers.
static java.awt.Image getWheel(int imgWidth, int imgHeight, int brightness, int[] pix)
          Compute a color wheel in a square panel of size width == height.
static int[] getWheelAsInt(int imgWidth, int imgHeight, int brightness, int[] pix)
          Compute a color wheel in a square panel of size width == height.
 void init()
           
 void mouseClicked(java.awt.event.MouseEvent event)
          Do nothing.
 void mouseDragged(java.awt.event.MouseEvent event)
          Invoce mousePressed.
 void mouseEntered(java.awt.event.MouseEvent event)
          Do nothing.
 void mouseExited(java.awt.event.MouseEvent event)
          Do nothing.
 void mouseMoved(java.awt.event.MouseEvent event)
          Do nothing.
 void mousePressed(java.awt.event.MouseEvent event)
          There are two panels which issue mouse events: If user clicks into the color wheel then current color is set.
 void mouseReleased(java.awt.event.MouseEvent event)
           
 void setColor(java.awt.Color rgbColor)
          Set current color and values of rgb sliders.
 void setDefColor(java.awt.Color rgbColor)
          Set the default color.
 boolean update(java.lang.Object event)
          Update dialog if color slider or brightness slider has changed.
 
Methods inherited from class jv.object.PsPanel
addLabelComponent, addLine, addSubTitle, addTextField, addTitle, drawBorder, drawBorder, drawBorder, drawBorder, drawText, getFather, getInsets, getLanguage, getTitle, hasTitle, instanceOf, paint, removeTitle, select, setBackColor, setBorderType, setEnabled, setImage, setInsetSize, setInsetSizeHorizontal, setInsetSizeVertical, setLabel, setLabel, setOutOfDate, setParent, setPreferredSize, setSelectedCheckbox, setState, setText, setText, setTitle, setVisible, update
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMinimumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.object.PsUpdateIf
getName
 

Constructor Detail

PuColorPicker

public PuColorPicker(java.awt.Color initColor)
Create a new color inspector with color wheel for picking colors. Note, PsConfig must be initialized prior to this call since PsImage needs the codeBase.

Method Detail

init

public void init()
Overrides:
init in class PsPanel

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
There are two panels which issue mouse events: If user clicks into the color wheel then current color is set. If user clicks into the default color field, then current color is reset.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Do nothing.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Do nothing.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Do nothing.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Do nothing.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Invoce mousePressed.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

getDefColor

public java.awt.Color getDefColor()
Get the default color.


setDefColor

public void setDefColor(java.awt.Color rgbColor)
Set the default color.


getColor

public java.awt.Color getColor()
Get current color selection.


setColor

public void setColor(java.awt.Color rgbColor)
Set current color and values of rgb sliders. Value of brightness slider is not modified.


update

public boolean update(java.lang.Object event)
Update dialog if color slider or brightness slider has changed.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PsPanel

getPreferredSize

public java.awt.Dimension getPreferredSize()
Get preferred size of this panel for inclusion in other containers.

Overrides:
getPreferredSize in class PsPanel

getWheelAsInt

public static int[] getWheelAsInt(int imgWidth,
                                  int imgHeight,
                                  int brightness,
                                  int[] pix)
Compute a color wheel in a square panel of size width == height. Shows all RGB color triples which have the same maximum equal to the given parameter brightness.

Parameters:
imgWidth - width of color wheel image in pixel
imgHeight - height of color wheel image in pixel
brightness - brighness of image in [0,255]
pix - array stores color as integer, maybe null.
Returns:
updated pixel array
Since:
JavaView 2.90.001

getWheel

public static java.awt.Image getWheel(int imgWidth,
                                      int imgHeight,
                                      int brightness,
                                      int[] pix)
Compute a color wheel in a square panel of size width == height. Shows all RGB color triples which have the same maximum equal to the given parameter brightness.

Parameters:
imgWidth - width of color wheel image in pixel
imgHeight - height of color wheel image in pixel
brightness - brighness of image in [0,255]
pix - array stores color as integer, maybe null.
Returns:
newly created image

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.