smith applet

smith applet - .setColor( Color. green );/// to green...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Applet Lulu import java.applet.*; import java.awt.*; import java.awt.event.*; public class brushes extends Applet implements MouseMotionListener { int width , height ; Image backbuffer ; Graphics bground ; //constructors public void init() { width = getSize(). width ; height = getSize(). height ; backbuffer = createImage( width , height ); bground = backbuffer .getGraphics();//back set bground .setColor( Color. red );/// to red bground .fillRect( 0, 0, width , height );// brush set bground
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: .setColor( Color. green );/// to green addMouseMotionListener( this ); } public void mouseDragged( MouseEvent e ) { // set action when mouse is dragged int x = e.getX(); int y = e.getY(); bground .fillOval(x-3,y-3,5,5); repaint(); e.consume(); } public void update( Graphics g ) { g.drawImage( backbuffer , 0, 0, this ); } public void paint( Graphics g ) { update( g ); } } Applet Lulu...
View Full Document

Page1 / 2

smith applet - .setColor( Color. green );/// to green...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online