Painting graphics primitives in Java