// Program 12.2: Draw a filled rectangle
import java.applet.Applet;    
import java.awt.Graphics; 

public class FillAndCenter extends Applet {


  public void paint(Graphics g) {

    int AppletHeight = size().height;
    int AppletWidth = size().width;
    int RectHeight = AppletHeight/3;
    int RectWidth = AppletWidth/3;
    int RectTop = (AppletHeight - RectHeight)/2;
    int RectLeft= (AppletWidth - RectWidth)/2;
    
    g.fillRect(RectTop, RectLeft, RectWidth-1, RectHeight-1);
    
  }

}
