net.java.dev.colorchooser
Class ColorChooserUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by net.java.dev.colorchooser.ColorChooserUI

public abstract class ColorChooserUI
extends ComponentUI

Parent class of UI delegates for color choosers. This class handles popping up palettes and selection/setting transient color and firing events. Generally, subclasses will simply want to override the painting logic.

To completely override all behavior, override installListeners() and uninstallListeners() and do not have them call super.


Constructor Summary
protected ColorChooserUI()
          Creates a new instance of ColorChooserUI
 
Method Summary
protected  void fireColorChanged(ColorChooser chooser)
          Cause the passed color chooser to fire an action event to its listeners notifying them that the color has changed.
 Dimension getMaximumSize(JComponent c)
           
 Dimension getMinimumSize(JComponent c)
           
 Dimension getPreferredSize(JComponent c)
           
protected  void init(ColorChooser c)
          Optional initialization method called from installUI()
protected  void installListeners(ColorChooser c)
          Begin listening for mouse events on the passed component
 void installUI(JComponent jc)
           
protected  void keyboardInvoke(ColorChooser colorChooser)
          Called when the color chooser is invoked from the keyboard (user pressed space or enter).
protected  int paletteIndexFromKeyCode(KeyEvent ke)
          Map a key event to an integer used to index into the array of available palettes, used to change which palette is displayed on the fly.
protected  int paletteIndexFromModifiers(InputEvent me)
          Map the modifiers on an input event to an integer used to index into the array of available palettes, used to change which palette is displayed on the fly.
protected  void uninit(ColorChooser c)
          Optional initialization method called from uninstallUI()
protected  void uninstallListeners(ColorChooser c)
          Stop listening for mouse events on the passed component
 void uninstallUI(JComponent jc)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorChooserUI

protected ColorChooserUI()
Creates a new instance of ColorChooserUI

Method Detail

installUI

public final void installUI(JComponent jc)
Overrides:
installUI in class ComponentUI

uninstallUI

public final void uninstallUI(JComponent jc)
Overrides:
uninstallUI in class ComponentUI

init

protected void init(ColorChooser c)
Optional initialization method called from installUI()


uninit

protected void uninit(ColorChooser c)
Optional initialization method called from uninstallUI()


installListeners

protected void installListeners(ColorChooser c)
Begin listening for mouse events on the passed component


uninstallListeners

protected void uninstallListeners(ColorChooser c)
Stop listening for mouse events on the passed component


paletteIndexFromKeyCode

protected int paletteIndexFromKeyCode(KeyEvent ke)
Map a key event to an integer used to index into the array of available palettes, used to change which palette is displayed on the fly. Note this method reads the key code, not the modifiers, of the key event.

If you override this method, also override paletteIndexFromModifiers.

The palette actually used is as follows:


paletteIndexFromModifiers

protected int paletteIndexFromModifiers(InputEvent me)
Map the modifiers on an input event to an integer used to index into the array of available palettes, used to change which palette is displayed on the fly. Note this method uses the value of from the event's getModifiersEx() method.

If you override this method, also override paletteIndexFromKeyCode.

The palette actually used is as follows:


keyboardInvoke

protected void keyboardInvoke(ColorChooser colorChooser)
Called when the color chooser is invoked from the keyboard (user pressed space or enter).


fireColorChanged

protected void fireColorChanged(ColorChooser chooser)
Cause the passed color chooser to fire an action event to its listeners notifying them that the color has changed.


getMaximumSize

public Dimension getMaximumSize(JComponent c)
Overrides:
getMaximumSize in class ComponentUI

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Overrides:
getMinimumSize in class ComponentUI

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Overrides:
getPreferredSize in class ComponentUI