public void paint( Graphics g )
    {
      super.paint(g);
      if (show_rough==true)  //显示毛坯
      {
        g.setColor(color1);
        g.fillRect( (600 - length_i) / 2, (500 - diameter_i) / 2,
                    (600 + length_i) / 2, (500 - diameter_i) / 2);
      }
    }谢谢

解决方案 »

  1.   

    就是调用父类的paint()方法,做一些初始化的工作。
      

  2.   

    看一下下面的程序里就懂了:class A
    {
      void prn()
      {
         System.out.println("I am in the A.prn()");
      }
    }public class B extends A
    {
       void prn()
       {
          super.prn();   //** 
          System.out.println("I am in the A.prn");
       }
       
        public static void main(String[] args)
        {
           B b=new B();
           b.prn();
        }
    }
    -----------------------------------------------------------------------------
       在上面的代码中如果没有调用super.prn(),那么打印结果将只会显示"I am in the A.prn()",如果调用了将显示两条打印语句:
       I am in the A.prn()
       I am in the B.prn()   因此,在你上面的代码中,调用的super.paint(g),是为了让父类办你做一些事前的工作,如刷新屏幕、重绘图像等等,不明白的话在发短消息给我。
      

  3.   

    谁不知道产掉用父类的的paint呀,但那个作用是什么啊??
    为什么不掉用会出现那个透明效果啊??