DeviceFactory.setDevice(new AppletDevice(emulatorContext));
AppletDevice device = new AppletDevice(); DeviceFactory.setDevice(device); device.init(emulatorContext);
  public void init()  {    instance = this;    MIDletBridge.setMicroEmulator(this);          addKeyListener(keyListener);    addMouseListener(mouseListener);    addMouseMotionListener(mouseMotionListener);        DeviceFactory.setDevice(new AppletDevice(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;  }