设置Graphics的render区域,在clip外的任何东西都是不会画的。一个矩形,左上角(x,y),宽width,高height.

解决方案 »

  1.   

    Sets the current clipping area to an arbitrary clip shape. Not all objects that implement the Shape interface can be used to set the clip. The only Shape objects that are guaranteed to be supported are Shape objects that are obtained via the getClip method and via Rectangle objects. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.Parameters:
    clip - the Shape to use to set the clip
      

  2.   

    设置剪切矩形,使Graphics对矩形之外的区域进行绘制无效。
    x , y 是矩形左上角坐标