01: /*
02: * Copyright (c) 2007, Sun Microsystems, Inc.
03: *
04: * All rights reserved.
05: *
06: * Redistribution and use in source and binary forms, with or without
07: * modification, are permitted provided that the following conditions
08: * are met:
09: *
10: * * Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * * Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in
14: * the documentation and/or other materials provided with the
15: * distribution.
16: * * Neither the name of Sun Microsystems, Inc. nor the names of its
17: * contributors may be used to endorse or promote products derived
18: * from this software without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23: * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
24: * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31: */
32:
33: package demo;
34:
35: import javax.microedition.midlet.*;
36: import javax.microedition.lcdui.*;
37:
38: /**
39: * Demo MIDlet creates, runs and displays DemoGameCanvas.
40: *
41: * @author Karel Herink
42: * @version 1.0
43: */
44: public class GameMidlet extends MIDlet {
45:
46: private DemoGameCanvas gameCanvas;
47: private Thread t;
48: private Display d;
49:
50: public void startApp() {
51: this .gameCanvas = new DemoGameCanvas();
52: this .t = new Thread(gameCanvas);
53: t.start();
54: d = Display.getDisplay(this );
55: d.setCurrent(gameCanvas);
56: }
57:
58: public void pauseApp() {
59: }
60:
61: public void destroyApp(boolean unconditional) {
62: this.gameCanvas.stop();
63: }
64: }
|