Interface ShapeObserver


public interface ShapeObserver
ShapeObserver接口定义了观察者模式中的观察者角色。 当被观察的图形对象发生变化时,会调用onShapeChanged()方法。

典型用法:

 shapeObservable.addObserver(new ShapeObserver() {
     public void onShapeChanged(Shape shape) {
         // 处理图形变化
     }
 });
 
Since:
1.0
Author:
liying
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    当被观察的图形发生变化时调用
  • Method Details

    • onShapeChanged

      void onShapeChanged(Shape shape)
      当被观察的图形发生变化时调用
      Parameters:
      shape - 发生变化的图形对象