acm.graphics
Interface GContainer

All Known Implementing Classes:
GCanvas, GCompound

public interface GContainer

Defines the functionality of an object that can serve as the parent of a GObject.


Field Summary
static int BACK_TO_FRONT
          Specifies that iterators should run from back to front
static int FRONT_TO_BACK
          Specifies that iterators should run from front to back
 
Method Summary
 void add(GObject gobj)
          Adds a new graphical object to this container.
 void add(GObject gobj, double x, double y)
          Adds the graphical object to this canvas and sets its location to the point (xy).
 void add(GObject gobj, GPoint pt)
          Adds the graphical object to this canvas and sets its location to the specified point.
 GObject getElement(int index)
          Returns the graphical object at the specified index, numbering from back to front in the the z dimension.
 GObject getElementAt(double x, double y)
          Returns the topmost graphical object that contains the point (x, y), or null if no such object exists.
 GObject getElementAt(GPoint pt)
          Returns the topmost graphical object that contains the specified point, or null if no such object exists.
 int getElementCount()
          Returns the number of graphical objects stored in this GCanvas.
 void remove(GObject gobj)
          Removes a graphical object from this container.
 void removeAll()
          Removes all graphical objects from this container.
 

Field Detail

BACK_TO_FRONT

static final int BACK_TO_FRONT
Specifies that iterators should run from back to front

See Also:
Constant Field Values

FRONT_TO_BACK

static final int FRONT_TO_BACK
Specifies that iterators should run from front to back

See Also:
Constant Field Values
Method Detail

add

void add(GObject gobj)
Adds a new graphical object to this container.

Parameters:
gobj - The graphical object to add

add

void add(GObject gobj,
         double x,
         double y)
Adds the graphical object to this canvas and sets its location to the point (xy).

Parameters:
gobj - The graphical object to add
x - The new x-coordinate for the object
y - The new y-coordinate for the object

add

void add(GObject gobj,
         GPoint pt)
Adds the graphical object to this canvas and sets its location to the specified point.

Parameters:
gobj - The graphical object to add
pt - A GPoint object giving the coordinates of the point

getElement

GObject getElement(int index)
Returns the graphical object at the specified index, numbering from back to front in the the z dimension.

Parameters:
index - The index of the component to return
Returns:
The graphical object at the specified index

getElementAt

GObject getElementAt(double x,
                     double y)
Returns the topmost graphical object that contains the point (x, y), or null if no such object exists.

Parameters:
x - The x-coordinate of the point being tested
y - The y-coordinate of the point being tested
Returns:
The graphical object at the specified location, or null if no such object exists.

getElementAt

GObject getElementAt(GPoint pt)
Returns the topmost graphical object that contains the specified point, or null if no such object exists.

Parameters:
pt - The coordinates being tested
Returns:
The graphical object at the specified location, or null if no such object exists

getElementCount

int getElementCount()
Returns the number of graphical objects stored in this GCanvas.

Returns:
The number of graphical objects in this GCanvas

remove

void remove(GObject gobj)
Removes a graphical object from this container.

Parameters:
gobj - The graphical object to remove

removeAll

void removeAll()
Removes all graphical objects from this container.