Class ColorWell
All Packages Class Hierarchy This Package Previous Next Index
Class ColorWell
public class netscape.application.ColorWell
extends netscape.application.DragWell
implements netscape.application.DragDestination,
netscape.application.Target
{
/* Fields
*/
public final static String SHOW_COLOR_CHOOSER;
/* Constructors
*/
public ColorWell();
public ColorWell(Rect);
public ColorWell(int, int, int, int);
/* Methods
*/
public DragDestination acceptsDrag(DragSession, int, int);
public boolean canBecomeSelectedView();
public Color color();
public String command();
public String dataType();
public void decode(Decoder);
public void describeClassInfo(ClassInfo);
public boolean dragDropped(DragSession);
public boolean dragEntered(DragSession);
public void dragExited(DragSession);
public boolean dragMoved(DragSession);
public void drawView(Graphics);
public void encode(Encoder);
public Image image();
public boolean mouseDown(MouseEvent);
public void mouseDragged(MouseEvent);
public void mouseUp(MouseEvent);
public void performCommand(String, Object);
public void sendCommand();
public void setColor(Color);
public void setCommand(String);
public void setData(Object);
public void setDataType(String);
public void setImage(Image);
public void setTarget(Target);
public Target target();
}
DragWell subclass that accepts and vends drag-and-dropped Colors. When the
user drops a Color onto a ColorWell, the ColorWell sets its color to that
dropped color and sends a command to its Target.
Fields
SHOW_COLOR_CHOOSER
public final static String SHOW_COLOR_CHOOSER
- Sending this command to a ColorWell will show the color chooser
Constructors
.ColorWell
public ColorWell()
- Constructs a ColorWell with origin (0, 0) and zero
width and height.
.ColorWell
public ColorWell(Rect rect)
- Constructs a ColorWell with bounds rect.
.ColorWell
public ColorWell(int x,
int y,
int width,
int height)
- Constructs a ColorWell with bounds
(x, y, width, height).
Methods
public void setColor(Color aColor)
- Sets the ColorWell's color and then calls draw() to redraw it.
If you do not want to immediately redraw the ColorWell, you should
first call its disableDrawing() method.
- See Also:
- disableDrawing
public Color color()
- Returns the ColorWell's color.
- See Also:
- setColor
public void setData(Object anObject)
- Overridden to enforce setting of Colors only.
- Overrides:
- setData in class DragWell
- See Also:
- setColor
public Image image()
- Returns an Image containing the current Color, suitable for dragging.
- Overrides:
- image in class DragWell
public void setImage(Image image)
- Overriden to throw an error. ColorWells always return an Image
representing the current color.
- Overrides:
- setImage in class DragWell
public void setDataType(String dataType)
- Overriden to throw an error. ColorWells always return a drag type
of Color.COLOR_TYPE.
- Overrides:
- setDataType in class DragWell
public String dataType()
- Returns Color.COLOR_TYPE.
- Overrides:
- dataType in class DragWell
public void setTarget(Target aTarget)
- Sets the ColorWell's Target, the object the ColorWell notifies when
the user drops a Color onto it.
- See Also:
- performCommand
public Target target()
- Returns the ColorWell's Target.
- See Also:
- setTarget
public void setCommand(String command)
- Sets the command sent by the ColorWell to its Target when the user
drops a Color into it.
- See Also:
- setTarget
public String command()
- Returns the command sent by the ColorWell to its Target.
- See Also:
- setCommand
public void drawView(Graphics g)
- Draws the ColorWell by drawing its Border, filled with the ColorWell's
color.
- Overrides:
- drawView in class DragWell
- See Also:
- setBorder
public boolean mouseDown(MouseEvent event)
- Initiates a drag-session where the user can drag the ColorWell's color,
unless the ColorWell is disabled (in which case nothing happens). A
double-click in the well invokes the ColorChooser.
- Returns:
- false if disabled, true otherwise.
- Overrides:
- mouseDown in class DragWell
- See Also:
- setEnabled, ColorChooser
public void mouseDragged(MouseEvent event)
- Overridden to support creating a Color drag-session.
- Overrides:
- mouseDragged in class View
- See Also:
- mouseDown
public void mouseUp(MouseEvent event)
- Overridden to support creating a Color drag-session.
- Overrides:
- mouseUp in class View
- See Also:
- mouseDown
public DragDestination acceptsDrag(DragSession session,
int x,
int y)
- Returns the ColorWell if the DragSession has a data type of
Color.COLOR_TYPE, null otherwise.
- Overrides:
- acceptsDrag in class View
- See Also:
- dataType
public boolean dragEntered(DragSession session)
- DragDestination support method.
- See Also:
- dragEntered
public boolean dragMoved(DragSession session)
- DragDestination support method.
- See Also:
- dragMoved
public void dragExited(DragSession session)
- DragDestination support method.
- See Also:
- dragExited
public boolean dragDropped(DragSession session)
- Drag-and-drop destination support method, called when the user
releases a DragSession's Image over the ColorWell. If the DragSession
represents a Color, the ColorWell calls its setColor() method
with the dropped Color and sends its command to its Target. If the
ColorWell is disabled, or the DragSession doesn't represent a Color,
the ColorWell refuses the object. Returns true if the session
was accepted, false otherwise.
- See Also:
- setColor, setEnabled, dragDropped
public void sendCommand()
- Called by the ColorWell to send its command to its Target.
- See Also:
- setTarget, setCommand
public void performCommand(String command,
Object data)
- Overriden to show the color chooser
public void describeClassInfo(ClassInfo info)
- Describes the ColorWell class' coding information.
- Overrides:
- describeClassInfo in class DragWell
- See Also:
- describeClassInfo
public void encode(Encoder encoder) throws CodingException
- Encodes the ColorWell.
- Overrides:
- encode in class DragWell
- See Also:
- encode
public void decode(Decoder decoder) throws CodingException
- Decodes the ColorWell.
- Overrides:
- decode in class DragWell
- See Also:
- decode
public boolean canBecomeSelectedView()
- Overriden to return true
- Overrides:
- canBecomeSelectedView in class View
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997