// constructor
Canvas canvas = new MyCanvas(); Display display = Display.getDisplay(this); display.setCurrent(canvas);