previous | index | next

Bean Components

Java beans are classes with instance fields that conform to conventions for getter and setter methods.

Here is a bean class that draws a car: CarBean.java.

Note that the instance fields x and y, the coordinates of the upper left corner of the drawing, conform to the get/set conventions of bean properties.

Note also that the set methods not only set the instance field's value but also call repaint.


previous | index | next