PATH  Documentation > Mac OS X > Application Kit Reference: Java

Table of Contents

NSColorPicker


Inherits from:
NSObject
Implements:
NSColorPickingDefault
Package:
com.apple.yellow.application


Class Description


NSColorPicker is an abstract superclass that implements the NSColorPickingDefault protocol. The NSColorPickingDefault and NSColorPickingCustom protocols define a way to add color pickers (custom user interfaces for color selection) to the NSColorPanel. The simplest way to implement a color picker is to create a subclass of NSColorPicker, instead of implementing the NSColorPickingDefault protocol in another kind of object. (To add functionality, implement the NSColorPickingCustom methods in your subclass.)

The NSColorPickingDefault protocol specification describes the details of implementing a color picker and adding it to your application's NSColorPanel; you should look there first for an overview of how NSColorPicker works. This specification is provided to document the specific behavior of NSColorPicker's methods.




Interfaces Implemented


NSColorPickingDefault
alphaControlAddedOrRemoved
attachColorList
detachColorList
insertNewButtonImage
provideNewButtonImage
setMode
viewSizeChanged


Method Types


Constructors
NSColorPicker
Getting the color panel
colorPanel
Adding button images
insertNewButtonImage
provideNewButtonImage
Setting the mode
setMode
Using color lists
attachColorList
detachColorList
Responding to a resized view
viewSizeChanged


Constructors



NSColorPicker

public NSColorPicker()

Description forthcoming.

public NSColorPicker( int mask, NSColorPanel owningColorPanel)

Creates a color picker, setting its color panel to owningColorPanel, caching the owningColorPanel value so it can later be returned by the colorPanel method. Write your own version of this method in your superclass to respond to the values in mask or do other custom initialization. If you do write your own version, forward the message to super as part of the implementation.

See Also: - colorPanel




Instance Methods



alphaControlAddedOrRemoved

public void alphaControlAddedOrRemoved(Object sender)

Description forthcoming.

attachColorList

public void attachColorList(NSColorList colorList)

Does nothing. Override to attach a color list to a color picker.

See Also: detachColorList



colorPanel

public NSColorPanel colorPanel()

Returns the NSColorPanel that owns this NSColorPicker.

detachColorList

public void detachColorList(NSColorList colorList)

Does nothing. Override to detach a color list from a color picker.

See Also: attachColorList



insertNewButtonImage

public void insertNewButtonImage( NSImage newButtonImage, NSButtonCell buttonCell)

Sets newButtonImage as buttonCell's image by invoking NSButtonCell's setImage: method. Called by the color panel to insert a new image into the specified cell. Override this method to customize newButtonImage before insertion in buttonCell.

See Also: provideNewButtonImage



provideNewButtonImage

public NSImage provideNewButtonImage()

Returns the button image for the color picker. The color panel will place this image in the mode button the user uses to select this picker. (This is the same image the color panel uses as an argument when sending the insertNewButtonImage message.) The default implementation looks in the color picker's bundle for a TIFF file named after the color picker's class, with the extension ".tiff".

See Also: insertNewButtonImage



setMode

public void setMode(int mode)

Does nothing. Override to set the color picker's mode. Here are the standard color picking modes and mode constants:
Mode Color Mode Constant
Grayscale-Alpha GrayModeColorPanel
Red-Green-Blue RGBModeColorPanel
Cyan-Yellow-Magenta-Black CMYKModeColorPanel
Hue-Saturation-Brightness HSBModeColorPanel
Custom palette CustomPaletteModeColorPanel
Custom color list ColorListModeColorPanel
Color wheel WheelModeColorPanel

In grayscale-alpha, red-green-blue, cyan-magenta-yellow-black, and hue-saturation-brightness modes, the user adjusts colors by manipulating sliders. In the custom palette mode, the user can load an NSImage file (TIFF or EPS) into the NSColorPanel, then select colors from the image. In custom color list mode, the user can create and load lists of named colors. The two custom modes provide NSPopUpLists for loading and saving files. Finally, color wheel mode provides a simplified control for selecting colors.



viewSizeChanged

public void viewSizeChanged(Object sender)

Does nothing. Override to respond to a size change.


Table of Contents