1 package org
.sourceforge
.astei
.desert
;
3 import java
.applet
.Applet
;
5 import java
.awt
.event
.ActionEvent
;
6 import java
.awt
.event
.ActionListener
;
7 import javax
.swing
.SwingUtilities
;
8 import javax
.swing
.Timer
;
13 * @author codistmonk (modifications since 2010-04-13)
15 public class DesertApplet
extends Applet
implements ActionListener
{
17 private final DrawingBoard drawingBoard
;
19 private final Timer updater
;
21 public DesertApplet() {
22 this.drawingBoard
= new DrawingBoard();
23 this.updater
= new Timer(40, this);
27 public final void init() {
28 this.setLayout(new BorderLayout());
29 this.add(this.drawingBoard
, BorderLayout
.CENTER
);
35 public final void actionPerformed(final ActionEvent event
) {
36 if (!SwingUtilities
.isEventDispatchThread()) {
37 throw new IllegalStateException("This method must be executed in the AWT Event Thread");
40 this.drawingBoard
.update(this.updater
.getDelay() / 1000.0);
41 this.drawingBoard
.repaint();