acm.graphics
Interface GContainer

All Known Implementing Classes:
GCompound, GCanvas

public interface GContainer

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


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 container and sets its location to the point (xy).
void add(GObject gobj, java.awt.Point pt)
Adds the graphical object to this container 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 stacking order.
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(Point 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.
 

Method Detail

public void add(GObject gobj)

Adds a new graphical object to this container.
 
Usage: gc.add(gobj);
Parameter: 
gobj  The graphical object to add
 

public void add(GObject gobj, double x, double y)

Adds the graphical object to this container and sets its location to the point (xy).
 
Usage: gc.add(gobj, x, y);
Parameters: 
gobj  The graphical object to add
x  The new x-coordinate for the object
y  The new y-coordinate for the object
 

public void add(GObject gobj, Point pt)

Adds the graphical object to this container and sets its location to the specified point.
 
Usage: gc.add(gobj, pt);
Parameters: 
gobj  The graphical object to add
pt  A Point object giving the coordinates of the point
 

public GObject getElement(int index)

Returns the graphical object at the specified index, numbering from back to front in the stacking order.
 
Usage: GObject gobj = gc.getElement(index);
Parameter: 
index  The index of the component to return
Returns: The graphical object at the specified index
 

public GObject getElementAt(double x, double y)

Returns the topmost graphical object that contains the point (x, y), or null if no such object exists.
 
Usage: GObject gobj = gc.getElementAt(x, y);
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.
 

public GObject getElementAt(Point pt)

Returns the topmost graphical object that contains the specified point, or null if no such object exists.
 
Usage: GObject gobj = gc.getElementAt(pt);
Parameter: 
pt  The coordinates being tested
Returns: The graphical object at the specified location, or null if no such object exists
 

public int getElementCount()

Returns the number of graphical objects stored in this GCanvas.
 
Usage: int n = gc.getElementCount();
Returns: The number of graphical objects in this GCanvas
 

public void remove(GObject gobj)

Removes a graphical object from this container.
 
Usage: gc.remove(gobj);
Parameter: 
gobj  The graphical object to remove
 

public void removeAll()

Removes all graphical objects from this container.
 
Usage: gc.removeAll();