System.out.println("Applet::init()"); if (midlet != null) { return; }
  public void init()  {    instance = this;    MIDletBridge.setMicroEmulator(this);          addKeyListener(keyListener);    addMouseListener(mouseListener);    addMouseMotionListener(mouseMotionListener);        AppletDevice device;    String deviceClassName = getParameter("device");    if (deviceClassName == null) {      device = new AppletDevice();        } else {      try {      	Class cl = Class.forName(deviceClassName);        device = (AppletDevice) cl.newInstance();      } catch (ClassNotFoundException ex) {        System.out.println(ex);        return;      } catch (IllegalAccessException ex) {        System.out.println(ex);        return;      } catch (InstantiationException ex) {        System.out.println(ex);        return;      }    }    DeviceFactory.setDevice(device);    device.init(emulatorContext);    String midletName = getParameter("midlet");		if (midletName == null) {			System.out.println("There is no midlet parameter");			return;		}        Class midletClass;		try {			midletClass = Class.forName(midletName);		} catch (ClassNotFoundException ex) {			System.out.println("Cannot find " + midletName + " MIDlet class");			return;		}    try {      midlet = (MIDlet) midletClass.newInstance();    } catch (Exception ex) {      System.out.println("Cannot initialize " + midletClass + " MIDlet class");      System.out.println(ex);              ex.printStackTrace();      return;    }    Image tmpImg = ((AppletDevice) DeviceFactory.getDevice()).getNormalImage();    resize(tmpImg.getWidth(null), tmpImg.getHeight(null));        return;  }