// DrawJPanel1.java
// Demos a JPanel used as a dedicated drawing area
import java.awt.*;
import javax.swing.*;

public class DrawJPanel1 extends JPanel {
	private int width, height;
	private Color drawColor;

	public void paintComponent( Graphics g ) {
		// call to super class
		super.paintComponent( g );
		// my drawing code
		g.setColor( drawColor );
		g.fillRect( 20, 20, width, height );
	}

	public void drawingStuff( Color c, int w, int h ){
		// receives three arguments from applet
		drawColor = c;
		width = w;
		height = h;
		repaint( );		// calls paintComponent
	}
}