home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Java AWT

Previous Chapter 2
Simple Graphics
Next
 

2.4 Shape

The new Shape interface defines a single method; it requires a geometric object to be able to report its bounding box. Currently, the Rectangle and Polygon classes implement Shape; one would expect other geometric classes to implement Shape in the future. Although Component has the single method defined by the Shape interface, it does not implement the interface.

Shape Method

public abstract Rectangle getBounds() (New)

The getBounds() method returns the shape's bounding Rectangle. Once you have the bounding area, you can use methods like Graphics.copyArea() to copy the shape.


Previous Home Next
Dimension Book Index Rectangle

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java