怎样在窗体上画矩形?我写的代码,大家帮我看一下。
/* 
    *   ClassDemol.java 
    * 
    *   Created   on   2007年4月5日,   下午3:33 
    * 
    *   To   change   this   template,   choose   Tools   |   Template   Manager 
    *   and   open   the   template   in   the   editor. 
    */   
 package   hhh;   
 import   java.awt.Graphics;   
 /** 
    * 
    *   @author   Administrator 
    */ 
 public   class   ClassDemol   {               
             /**   Creates   a   new   instance   of   ClassDemol   */ 
             public   ClassDemol()   { 
             }   
             private   int   x;   
             private   int   y;   
             private   int   width;   
             private   int   height;   
             public   void   init()   { 
                         width   =   60; 
                         height   =   60; 
             }   
             public   void   SetPosition(int   xPos,   int   yPos)   { 
                         x=xPos; 
                         y=yPos; 
             }   
             public   void   paint(Graphics   g)   { 
                         SetPosition(20,20); 
                         g.drawRect(x,y,width,height); 
                         g.drawString( "1的位置 "+x,20,100); 
                         g.drawString( "1的位置 "+y,20,120);                                                                                                
                         g.drawRect(x,y,width,height); 
                         g.drawString( "2的位置 "+x,170,100); 
                         g.drawString( "2的位置 "+y,170,120);                           
             }                             
 }     
 /* 
    *   Main.java 
    * 
    *   Created   on   2007年4月2日,   上午8:19 
    * 
    *   To   change   this   template,   choose   Tools   |   Template   Manager 
    *   and   open   the   template   in   the   editor. 
    */   
 package   hhh;   
 import   java.awt.*;   
 import   java.awt.event.*;   
 import   javax.swing.*;   
 import   java.io.*;            
 /** 
    * 
    *   @author   Administrator 
    */ 
 public   class   Main   extends   Frame{