public void mousePressed(MouseEvent evt) {
// This method will be called when the user clicks the
// mouse on the applet.
if ( evt.isShiftDown() ) {
// The user was holding down the Shift key. Just
// repaint the applet, which will fill it with its
// background color, black.
repaint();
return; }
int x = evt.getX(); // x-coordinate where user clicked.
int y = evt.getY(); // y-coordinate where user clicked.
Graphics g = getGraphics(); // Graphics context
// for drawing on the applet.
if ( evt.isMetaDown() ) { // User right-clicked at the point (x,y).
// Draw a blue oval centered at the point (x,y).
// A black outline around the oval will make it more
// distinct when ovals and rects overlap.
g.setColor(Color.blue);
g.fillOval( x - 25, y - 15, 60, 30 );
g.setColor(Color.black);
g.drawOval( x - 25, y - 15, 60, 30 );
}