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
{
/* Constructors
*/
public ColorWell();
public ColorWell(Rect);
public ColorWell(int, int, int, int);
/* Methods
*/
public DragDestination acceptsDrag(DragSession, int, int);
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 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.
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
setColor
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
color
public Color color()
- Returns the ColorWell's color.
- See Also:
- setColor
setData
public void setData(Object anObject)
- Overridden to enforce setting of Colors only.
- Overrides:
- setData in class DragWell
- See Also:
- setColor
image
public Image image()
- Returns an Image containing the current Color, suitable for dragging.
- Overrides:
- image in class DragWell
setImage
public void setImage(Image image)
- Overriden to throw an error. ColorWells always return an Image
representing the current color.
- Overrides:
- setImage in class DragWell
setDataType
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
dataType
public String dataType()
- Returns Color.COLOR_TYPE.
- Overrides:
- dataType in class DragWell
setTarget
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
target
public Target target()
- Returns the ColorWell's Target.
- See Also:
- setTarget
setCommand
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
command
public String command()
- Returns the command sent by the ColorWell to its Target.
- See Also:
- setCommand
drawView
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
mouseDown
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
mouseDragged
public void mouseDragged(MouseEvent event)
- Overridden to support creating a Color drag-session.
- Overrides:
- mouseDragged in class View
- See Also:
- mouseDown
mouseUp
public void mouseUp(MouseEvent event)
- Overridden to support creating a Color drag-session.
- Overrides:
- mouseUp in class View
- See Also:
- mouseDown
acceptsDrag
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
dragEntered
public boolean dragEntered(DragSession session)
- DragDestination support method.
- See Also:
- dragEntered
dragMoved
public boolean dragMoved(DragSession session)
- DragDestination support method.
- See Also:
- dragMoved
dragExited
public void dragExited(DragSession session)
- DragDestination support method.
- See Also:
- dragExited
dragDropped
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
sendCommand
public void sendCommand()
- Called by the ColorWell to send its command to its Target.
- See Also:
- setTarget, setCommand
describeClassInfo
public void describeClassInfo(ClassInfo info)
- Describes the ColorWell class' coding information.
- Overrides:
- describeClassInfo in class DragWell
- See Also:
- describeClassInfo
encode
public void encode(Encoder encoder) throws CodingException
- Encodes the ColorWell.
- Overrides:
- encode in class DragWell
- See Also:
- encode
decode
public void decode(Decoder decoder) throws CodingException
- Decodes the ColorWell.
- Overrides:
- decode in class DragWell
- See Also:
- decode
All Packages Class Hierarchy This Package Previous Next Index