DEADSOFTWARE

Add script for build default stubs and libs
[mp3cc.git] / mps / src / FW.java
1 /*
2 * This is the framework file for the MIDLetPascal generated MIDlets
3 * The Pascal code is compiled into java class called M.
4 * */
5 import javax.microedition.midlet.*;
6 import javax.microedition.lcdui.*;
8 public class FW extends MIDlet implements CommandListener
9 {
10 public static FW fw = null;
11 public M m = null;
12 public boolean threadStarted = false;
13 public Display display;
14 public static int MP; // MidletPaused
16 // command & forms support
17 public static Form F;
18 public static Displayable CD;
19 public static Command LC;
20 public static List L;
21 public static Alert A;
22 public static TextBox TB;
24 public void startApp()
25 {
26 MP = 0;
28 display = Display.getDisplay(this);
30 fw = this;
32 LC = null;
34 if (m == null)
35 {
36 m = new M();
38 M.T = m;
39 M.I = Image.createImage(m.getWidth(), m.getHeight());
40 M.G = M.I.getGraphics();
41 M.KC = 0;
42 L = new List("", List.IMPLICIT);
43 A = new Alert("", "", null, AlertType.INFO);
44 TB = new TextBox("", "", 2, TextField.ANY);
45 display.setCurrent(m);
46 CD = m;
47 try
48 {
49 m.setCommandListener(this);
50 } catch (Exception e)
51 {
52 // do nothing, this catches the exception for NokiaAPI FullCanvas
53 }
54 F = new Form("");
55 F.setCommandListener(this);
56 }
57 else
58 {
59 m.repaint();
60 m.serviceRepaints();
61 }
63 if (! threadStarted)
64 {
65 new Thread(m).start();
66 threadStarted = true;
67 }
68 }
70 public void pauseApp()
71 {
72 MP = -1;
73 }
76 public void destroyApp(boolean unconditional)
77 {
78 m = null;
79 M.I = null;
80 M.G = null;
81 CD = null;
82 TB = null;
83 F = null;
84 A = null;
85 L = null;
86 fw = null;
87 LC = null;
88 notifyDestroyed();
89 }
91 public void commandAction(Command c, Displayable item) {
92 LC = c;
93 }
95 }