import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

import Begin.BeforeMenu;
import Begin.Start;
import Begin.WaveAnimate;
import Menu.Menu;

public class DreamBubbleMidlet extends MIDlet {

	public Menu menu;
	public SetUp setup;
	public Start start;
	public WaveAnimate waveAnimate;
	public BeforeMenu beforeMenu;

	public DreamBubbleMidlet() {
		setup = new SetUp(this);
	}

	public void init() {
		menu = new Menu(this);
		setup.loadPercent = 20;
		start = new Start(this);
		setup.loadPercent = 40;
		waveAnimate = new WaveAnimate(this);
		setup.loadPercent = 60;
		beforeMenu = new BeforeMenu(this);
		setup.loadPercent = 80;
		sleep();
		setup.loadPercent = 100;
		sleep();
	}

	public void sleep() {
		try {
			Thread.sleep(100);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	protected void destroyApp(boolean e) throws MIDletStateChangeException {

	}

	protected void pauseApp() {

	}

	protected void startApp() throws MIDletStateChangeException {
		setup.showMe();
	}

	public void show(Displayable d) {
		Display.getDisplay(this).setCurrent(d);
	}

	public void exit() {
		try {
			this.destroyApp(true);
		} catch (MIDletStateChangeException e) {
			e.printStackTrace();
		}
		this.notifyDestroyed();
	}
}
