Applet 中的动画

2025 年 3 月 17 日 | 阅读 1 分钟
Applet主要用于游戏和动画。为此,需要移动图像。

Applet中动画的例子

在上面的例子中,Graphics类的drawImage()方法用于显示图像。drawImage()方法的第四个参数是ImageObserver对象。Component类实现了ImageObserver接口。因此,当前类的对象也将被视为ImageObserver,因为Applet类间接扩展了Component类。

myapplet.html