更新时间:2023-09-10 10:23:10
在你的绘画方法(或从那里调用的方法)中,你应该只做绘画,不要做其他事情(比如检查鼠标在哪里等).
In your painting method (or methods called from there), you should only do painting, nothing else (like checking where the mouse is and such).
>
其他一切都应该单独完成.例如,计算(随机化)鼹鼠(或猴子?)的位置不应该在这里完成,而是在计时器方法中进行,例如.
Everything else should be done separately. For example, calculating (randomizing) the positions of the moles (or monkeys?) should not be done here, but in the timer method, for example.
您的小程序需要有一个模型,该模型将通过用户交互和随机事件进行修改.然后paint方法查看这个模型,并根据这个绘制.
Your applet needs to have a model, which will be modified by the user interaction and random events. The paint method then looks at this model, and paints according to this.