if (displayMode != -1) {
throw new IllegalStateException("mode already set");
}
if (mode != USE_DIRECT_VIDEO && mode != USE_GUI_PRIMITIVE) {
throw new IllegalArgumentException("unsupported mode");
}
if (mode == USE_DIRECT_VIDEO && !(container instanceof Canvas)) {
throw new IllegalArgumentException("container needs to be a Canvas");
}
if (mode == USE_GUI_PRIMITIVE && container != null) {
if (!(container instanceof String)) {
throw new IllegalArgumentException("container not valid");
}
if (!(container.equals("javax.microedition.lcdui.Item"))) {
throw new IllegalArgumentException("container not valid");
}
}
if (mode == USE_DIRECT_VIDEO) {
canvas = (Canvas)container;