1 package ubc.midp.mobilephoto.core.ui.screens;
2
3 import java.util.*;
4 import javax.microedition.lcdui.*;
5
6 /**
7 *
8 * @author tyoung
9 * This is a splash screen that will display for a brief period when the
10 * application loads. It is currently disabled, and hasn't been tested yet.
11 */
12 public class SplashScreen extends Canvas {
13
14 private Display display;
15 private Displayable next;
16 private Timer timer = new Timer();
17
18 /**
19 * Constructor
20 */
21 public SplashScreen(Display display, Displayable next) {
22 this.display = display;
23 this.next = next;
24
25 display.setCurrent(this);
26 }
27
28 /*
29 * If a key is pressed, dismiss the splash screen.
30 * (non-Javadoc)
31 * @see javax.microedition.lcdui.Canvas#keyPressed(int)
32 */
33 protected void keyPressed(int keyCode) {
34 dismiss();
35 }
36
37 protected void paint(Graphics g) {
38 // do your drawing here
39 }
40
41 protected void pointerPressed(int x, int y) {
42 dismiss();
43 }
44
45 protected void showNotify() {
46 timer.schedule(new CountDown(), 5000);
47 }
48
49 private void dismiss() {
50 timer.cancel();
51 display.setCurrent(next);
52 }
53
54 private class CountDown extends TimerTask {
55 public void run() {
56 dismiss();
57 }
58 }
59 }
|