Java code for a simple canvas application.