You are on page 1of 4

java.

awt
Interface Paint

public interface Paint


extends Transparency
This Paint interface defines how color patterns can be generated for Graphics2D operations. A class implementing the Paint interface is added to the Graphics2D context in order to
define the color pattern used by the draw and fill methods.

Field Summary

Fields inherited from interface java.awt.Transparency

BITMASK, OPAQUE, TRANSLUCENT

Method Summary

PaintContex createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform,


t RenderingHints hints)
Creates and returns a PaintContext used to generate the color pattern.

Methods inherited from interface java.awt.Transparency

getTransparency

Method Detail

createContext
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
Creates and returns a PaintContext used to generate the color pattern. Since the ColorModel argument to createContext is only a hint, implementations of Paint should accept a
null argument for ColorModel. Note that if the application does not prefer a specific ColorModel, the null ColorModel argument will give the Paint implementation full leeway in
using the most efficient ColorModel it prefers for its raster processing.
Since the API documentation was not specific about this in releases before 1.4, there may be implementations of Paint that do not accept a null ColorModel argument. If a
developer is writing code which passes a null ColorModel argument to the createContext method of Paint objects from arbitrary sources it would be wise to code
defensively by manufacturing a non-null ColorModel for those objects which throw a NullPointerException.

Parameters:
cm - the ColorModel that receives the Paint data. This is used only as a hint.
deviceBounds - the device space bounding box of the graphics primitive being rendered
userBounds - the user space bounding box of the graphics primitive being rendered
xform - the AffineTransform from user space into device space
hints - the hint that the context object uses to choose between rendering alternatives
Returns:
the PaintContext for generating color patterns
See Also:
PaintContext

java.awt.event
Class ActionEvent
public class ActionEvent
extends AWTEvent
A semantic event which indicates that a component-defined action occured. This high-level event is generated by a component (such as a Button) when the component-specific action occurs
(such as being pressed). The event is passed to every every ActionListener object that registered to receive such events using the component's addActionListener method.
The object that implements the ActionListener interface gets this ActionEvent when the event occurs. The listener is therefore spared the details of processing individual mouse
movements and mouse clicks, and can instead process a "meaningful" (semantic) event like "button pressed".
Field Summary

static int ACTION_FIRST


The first number in the range of ids used for action events.

static int ACTION_LAST


The last number in the range of ids used for action events.

static int ACTION_PERFORMED


This event id indicates that a meaningful action occured.

static int ALT_MASK


The alt modifier.

static int CTRL_MASK


The control modifier.

static int META_MASK


The meta modifier.

static int SHIFT_MASK


The shift modifier.

Constructor Summary

ActionEvent(Object source, int id, String command)


Constructs an ActionEvent object.

ActionEvent(Object source, int id, String command, int modifiers)


Constructs an ActionEvent object with modifier keys.

ActionEvent(Object source, int id, String command, long when, int modifiers)
Constructs an ActionEvent object with the specified modifier keys and timestamp.

Method Summary

Strin getActionCommand()
g Returns the command string associated with this action.

int getModifiers()
Returns the modifier keys held down during this action event.

lon getWhen()
g Returns the timestamp of when this event occurred.

Strin paramString()
g Returns a parameter string identifying this action event.

Field Detail

SHIFT_MASK
public static final int SHIFT_MASK
The shift modifier. An indicator that the shift key was held down during the event.
See Also:
Constant Field Values
!
CTRL_MASK
public static final int CTRL_MASK
The control modifier. An indicator that the control key was held down during the event.
See Also:
Constant Field Values
!
META_MASK
public static final int META_MASK
The meta modifier. An indicator that the meta key was held down during the event.
See Also:
Constant Field Values
!
ALT_MASK
public static final int ALT_MASK
The alt modifier. An indicator that the alt key was held down during the event.
See Also:
Constant Field Values
!
ACTION_FIRST
public static final int ACTION_FIRST
The first number in the range of ids used for action events.
See Also:
Constant Field Values
!
ACTION_LAST
public static final int ACTION_LAST
The last number in the range of ids used for action events.
See Also:
Constant Field Values
!
ACTION_PERFORMED
public static final int ACTION_PERFORMED
This event id indicates that a meaningful action occured.
See Also:
Constant Field Values

Constructor Detail

ActionEvent
public ActionEvent(Object source,
int id,
String command)
Constructs an ActionEvent object.

Note that passing in an invalid id results in unspecified behavior.

Parameters:
source - the object that originated the event
id - an integer that identifies the event
command - a string that may specify a command (possibly one of several) associated with the event
!
ActionEvent
public ActionEvent(Object source,
int id,
String command,
int modifiers)
Constructs an ActionEvent object with modifier keys.

Note that passing in an invalid id results in unspecified behavior.

Parameters:
source - the object that originated the event
id - an integer that identifies the event
command - a string that may specify a command (possibly one of several) associated with the event
modifiers - the modifier keys held down during this action
!
ActionEvent
public ActionEvent(Object source,
int id,
String command,
long when,
int modifiers)
Constructs an ActionEvent object with the specified modifier keys and timestamp.
Note that passing in an invalid id results in unspecified behavior.

Parameters:
source - the object that originated the event
id - an integer that identifies the event
command - a string that may specify a command (possibly one of several) associated with the event
when - the time the event occurred
modifiers - the modifier keys held down during this action
Since:
1.4

Method Detail

getActionCommand
public String getActionCommand()
Returns the command string associated with this action. This string allows a "modal" component to specify one of several commands, depending on its state. For example, a single
button might toggle between "show details" and "hide details". The source object and the event would be the same in each case, but the command string would identify the
intended action.
Returns:
the string identifying the command for this event
!
getWhen
public long getWhen()
Returns the timestamp of when this event occurred. Because an ActionEvent is a high-level, semantic event, the timestamp is typically the same as an underlying InputEvent.
Returns:
this event's timestamp
Since:
1.4
!
getModifiers
public int getModifiers()
Returns the modifier keys held down during this action event.
Returns:
the bitwise-or of the modifier constants
!
paramString
public String paramString()
Returns a parameter string identifying this action event. This method is useful for event-logging and for debugging.
Overrides:
paramString in class AWTEvent
Returns:
a string identifying the event and its associated command

You might also like