javax.microedition.lcdui.Canvas Java Examples

The following examples show how to use javax.microedition.lcdui.Canvas. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PanoramaCanvas.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * deal with any key presses
 */
protected void keyPressed(int keyCode) {
	switch(keyCode){
	case -1:	//up
	case Canvas.UP:
		y = getY(y+=STEP);
		break;
	case -2: //down
	case Canvas.DOWN:
		y = getY(y+=-STEP);
		break;
	case -3:	//left
	case Canvas.LEFT:
		x = getX(x+=STEP);
		break;
	case -4: //right
	case Canvas.RIGHT:
		x = getX(x+=-STEP);
		break;
	default:
	}
	repaint();

}
 
Example #2
Source File: GameCanvasImplementation.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @inheritDoc
 */
private void setCurrent(Displayable d) {
    if (display == null) {
        throw new IllegalStateException("First call Display.setDisplay(javax.microedition.lcdui.Display d) method");
    }

    if(!minimized) {
        if (d instanceof Canvas) {
            if(!disableFullScreen) {
                ((Canvas) d).setFullScreenMode(!com.codename1.ui.Display.getInstance().isNativeCommands());
            }
        }

        display.setCurrent(d);
    }
}
 
Example #3
Source File: Button.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
Button(Canvas parent, String text, Runnable clickHandler) throws Exception {
    // CanvasGraphicsItem needs a non-zero size for its construction.
    super(1, 1);
    this.setParent(parent);
    this.text = text;
    this.clickHandler = clickHandler;
    try {
        // Create different button states with distinct look and colors
        this.normalState = new ButtonState(
                this, "midlets/blogwriter/images/NormalButton.png", 0xFFFFFF);
        this.pressedState = new ButtonState(
                this, "midlets/blogwriter/images/PressedButton.png", 0xFFB600);
        this.dimmedState = new ButtonState(
                this, "midlets/blogwriter/images/DimmedButton.png", 0xa0a0a0);
    } catch (Exception ex) {
        throw ex;
    }
    // Set size based on normal state size
    this.setSize(this.normalState.getWidth(), this.normalState.getHeight());
    this.updateState();
    this.setVisible(true);
    this.repaint();
}
 
Example #4
Source File: MidletThread.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
static void destroyApp() {
	new Thread(() -> {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		Process.killProcess(Process.myPid());
	}, "ForceDestroyTimer").start();
	Displayable current = ContextHolder.getActivity().getCurrent();
	if (current instanceof Canvas) {
		Canvas canvas = (Canvas) current;
		int keyCode = Canvas.convertKeyCode(Canvas.KEY_END);
		Display.postEvent(CanvasEvent.getInstance(canvas, CanvasEvent.KEY_PRESSED, keyCode));
		Display.postEvent(CanvasEvent.getInstance(canvas, CanvasEvent.KEY_RELEASED, keyCode));
	}
	instance.handler.obtainMessage(DESTROY, 1).sendToTarget();
}
 
Example #5
Source File: MicroLoader.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
@SuppressLint("SimpleDateFormat")
public Single<String> takeScreenshot(Canvas canvas) {
	return Single.create(emitter -> {
		Bitmap bitmap = canvas.getOffscreenCopy().getBitmap();
		Calendar calendar = Calendar.getInstance();
		Date now = calendar.getTime();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
		String fileName = "Screenshot_" + simpleDateFormat.format(now) + ".png";
		File screenshotDir = new File(Config.SCREENSHOTS_DIR);
		File screenshotFile = new File(screenshotDir, fileName);
		if (!screenshotDir.exists()) {
			screenshotDir.mkdirs();
		}
		FileOutputStream out = new FileOutputStream(screenshotFile);
		bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
		emitter.onSuccess(screenshotFile.getAbsolutePath());
	});
}
 
Example #6
Source File: KeyMapper.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
public static void initArray(SparseIntArray intDict) {
	intDict.put(KeyEvent.KEYCODE_0, Canvas.KEY_NUM0);
	intDict.put(KeyEvent.KEYCODE_1, Canvas.KEY_NUM1);
	intDict.put(KeyEvent.KEYCODE_2, Canvas.KEY_NUM2);
	intDict.put(KeyEvent.KEYCODE_3, Canvas.KEY_NUM3);
	intDict.put(KeyEvent.KEYCODE_4, Canvas.KEY_NUM4);
	intDict.put(KeyEvent.KEYCODE_5, Canvas.KEY_NUM5);
	intDict.put(KeyEvent.KEYCODE_6, Canvas.KEY_NUM6);
	intDict.put(KeyEvent.KEYCODE_7, Canvas.KEY_NUM7);
	intDict.put(KeyEvent.KEYCODE_8, Canvas.KEY_NUM8);
	intDict.put(KeyEvent.KEYCODE_9, Canvas.KEY_NUM9);
	intDict.put(KeyEvent.KEYCODE_STAR, Canvas.KEY_STAR);
	intDict.put(KeyEvent.KEYCODE_POUND, Canvas.KEY_POUND);
	intDict.put(KeyEvent.KEYCODE_DPAD_UP, Canvas.KEY_UP);
	intDict.put(KeyEvent.KEYCODE_DPAD_DOWN, Canvas.KEY_DOWN);
	intDict.put(KeyEvent.KEYCODE_DPAD_LEFT, Canvas.KEY_LEFT);
	intDict.put(KeyEvent.KEYCODE_DPAD_RIGHT, Canvas.KEY_RIGHT);
	intDict.put(KeyEvent.KEYCODE_ENTER, Canvas.KEY_FIRE);
	intDict.put(KeyEvent.KEYCODE_SOFT_LEFT, Canvas.KEY_SOFT_LEFT);
	intDict.put(KeyEvent.KEYCODE_SOFT_RIGHT, Canvas.KEY_SOFT_RIGHT);
	intDict.put(KeyEvent.KEYCODE_CALL, Canvas.KEY_SEND);
	intDict.put(KeyEvent.KEYCODE_ENDCALL, Canvas.KEY_END);
}
 
Example #7
Source File: MicroActivity.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
@SuppressLint("CheckResult")
private void takeScreenshot() {
	microLoader.takeScreenshot((Canvas) current)
			.subscribeOn(Schedulers.computation())
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(new SingleObserver<String>() {
				@Override
				public void onSubscribe(Disposable d) {
				}

				@Override
				public void onSuccess(String s) {
					Toast.makeText(MicroActivity.this, getString(R.string.screenshot_saved)
							+ " " + s, Toast.LENGTH_LONG).show();
				}

				@Override
				public void onError(Throwable e) {
					e.printStackTrace();
					Toast.makeText(MicroActivity.this, R.string.error, Toast.LENGTH_SHORT).show();
				}
			});
}
 
Example #8
Source File: MMVideoItem.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
public Canvas toFullScreen() {
    if (fullScreen == null) {
        fullScreen = new FullScreenCanvas();
    }

    if (display == null) {
        MMHelper mmh = MMHelper.getMMHelper();
        if (mmh == null)
            return null;

        display = mmh.getDisplayFor(this);
        if (display == null)
            return null;
    }

    if (oldDisplayable == null)
        oldDisplayable = display.getCurrent();

    // Setting fullscreen canvas
    display.setCurrent(fullScreen);

    fullScreen.setFullScreenMode(true);
    
    _isFullScreen = true;

    return fullScreen;
}
 
Example #9
Source File: MicroActivity.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
	if (current != null) {
		menu.clear();
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.midlet_displayable, menu);
		if (current instanceof Canvas) {
			SubMenu group = menu.getItem(0).getSubMenu();
			if (actionBarEnabled) {
				inflater.inflate(R.menu.midlet_canvas_no_keys2, menu);
			} else {
				inflater.inflate(R.menu.midlet_canvas_no_keys, group);
			}
			VirtualKeyboard vk = ContextHolder.getVk();
			if (vk instanceof FixedKeyboard) {
				inflater.inflate(R.menu.midlet_canvas_fixed, group);
			} else if (vk != null) {
				inflater.inflate(R.menu.midlet_canvas, group);
			}
		}
		for (Command cmd : current.getCommands()) {
			menu.add(Menu.NONE, cmd.hashCode(), Menu.NONE, cmd.getAndroidLabel());
		}
	}

	return super.onPrepareOptionsMenu(menu);
}
 
Example #10
Source File: MicroActivity.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
@Override
public void openOptionsMenu() {
	if (!actionBarEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && current instanceof Canvas) {
		showSystemUI();
	}
	super.openOptionsMenu();
}
 
Example #11
Source File: MicroActivity.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
@Override
public void onWindowFocusChanged(boolean hasFocus) {
	super.onWindowFocusChanged(hasFocus);
	if (hasFocus && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && current instanceof Canvas) {
		hideSystemUI();
	}
}
 
Example #12
Source File: KeyRepeater.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
public void setTarget(Canvas canvas) {
	synchronized (keys) {
		releaseAllKeys();
		keys.clear();
		enabled = false;
	}

	target = canvas;
}
 
Example #13
Source File: CanvasTextBox.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
public CanvasTextBox(Canvas parent, String label, int type, int textLimit,
		boolean multiline) {
	super(1, 1);
	this.setParent(parent);
	this.label = label;
	this.textLimit = textLimit;
	this.multiline = multiline;

	this.labelFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN,
			Font.SIZE_LARGE);
	this.initializeTextEditor(parent, type);
	this.createStates();              
	this.setAutomaticSize();
}
 
Example #14
Source File: CanvasEvent.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
public static Event getInstance(Canvas canvas, int eventType, int width, int height) {
	CanvasEvent instance = recycled.pop();

	if (instance == null) {
		instance = new CanvasEvent();
	}

	instance.canvas = canvas;
	instance.eventType = eventType;
	instance.width = width;
	instance.height = height;

	return instance;
}
 
Example #15
Source File: CanvasEvent.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
public static Event getInstance(Canvas canvas, int eventType, int pointer, float x, float y) {
	CanvasEvent instance = recycled.pop();

	if (instance == null) {
		instance = new CanvasEvent();
	}

	instance.canvas = canvas;
	instance.eventType = eventType;
	instance.pointer = pointer;
	instance.x = x;
	instance.y = y;

	return instance;
}
 
Example #16
Source File: CanvasEvent.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
public static Event getInstance(Canvas canvas, int eventType, int keyCode) {
	CanvasEvent instance = recycled.pop();

	if (instance == null) {
		instance = new CanvasEvent();
	}

	instance.canvas = canvas;
	instance.eventType = eventType;
	instance.keyCode = keyCode;

	return instance;
}
 
Example #17
Source File: CanvasEvent.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
public static Event getInstance(Canvas canvas, int eventType) {
	CanvasEvent instance = recycled.pop();

	if (instance == null) {
		instance = new CanvasEvent();
	}

	instance.canvas = canvas;
	instance.eventType = eventType;

	return instance;
}
 
Example #18
Source File: CanvasTextBox.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates TextEditor instance and sets its properties.
 */
private void initializeTextEditor(Canvas parent, int type) {
	this.textEditor = TextEditor.createTextEditor("", this.textLimit, type,
			this.controlWidth - 2 * this.textEditorMargin,
			(this.multiline ? 2 : 1) * (labelFont.getHeight()));

	this.textEditor.setParent(parent);
	if (this.multiline) {
		this.textEditor.setMultiline(true);

		/*
          		//Enable indicator on JRT version 2.1 for symbian devices by uncommenting the following code. 
        		//JRT versions 2.2 and newer already contain the indicator in the virtual keyboard.

           if (this.textEditor instanceof com.nokia.mid.ui.S60TextEditor) {
               this.textEditor.setSize(this.textEditor.getWidth() - Scrollbar.width, this.textEditor.getHeight());
               //this.scrollbar = new Scrollbar(this.textEditor, 0xaaaaaa, 0x101010);
           }*/

		if(BlogWriter.isS60Platform())
			this.scrollbar = new Scrollbar(this.textEditor, 0xaaaaaa, 0x101010);
	}

	if(!BlogWriter.isS60Platform())
	{
		this.controls = new Controls(this.textEditor, 0x101010, 0xaaaaaa, 0xffffff);
	}
	this.textEditor.setTextEditorListener(this);
	this.setZPosition(1);
	this.textEditor.setZPosition(2);
}
 
Example #19
Source File: CanvasTextBox.java    From pluotsorbet with GNU General Public License v2.0 4 votes vote down vote up
public CanvasTextBox(Canvas parent, String label, int type, int textLimit) {
	// Construct single line text box with default width
	this(parent, label, type, textLimit, false);
}
 
Example #20
Source File: GameCanvas.java    From pluotsorbet with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new instance of a GameCanvas.  A new buffer is also created
 * for the GameCanvas and is initially filled with white pixels.
 * <p>
 * If the developer only needs to query key status using the getKeyStates
 * method, the regular key event mechanism can be suppressed for game keys
 * while this GameCanvas is shown.  If not needed by the application, the 
 * suppression of key events may improve performance by eliminating 
 * unnecessary system calls to keyPressed, keyRepeated and keyReleased 
 * methods. 
 * <p>
 * If requested, key event suppression for a given GameCanvas is started 
 * when it is shown (i.e. when showNotify is called) and stopped when it
 * is hidden (i.e. when hideNotify is called).  Since the showing and 
 * hiding of screens is serialized with the event queue, this arrangement
 * ensures that the suppression effects only those key events intended for
 * the corresponding GameCanvas.  Thus, if key events are being generated
 * while another screen is still shown, those key events will continue to
 * be queued and dispatched until that screen is hidden and the GameCanvas
 * has replaced it.
 * <p>
 * Note that key events can be suppressed only for the defined game keys 
 * (UP, DOWN, FIRE, etc.); key events are always generated for all other 
 * keys.  
 * <p>
 * @param suppressKeyEvents <code>true</code> to suppress the regular
 * key event mechanism for game keys, otherwise <code>false</code>.
 */
protected GameCanvas(boolean suppressKeyEvents) {
    // Create and offscreen Image object that
    // acts as the offscreen buffer to which we draw to.
    // the contents of this buffer are flushed to the display
    // only when flushGraphics() has been called.
    super();
    setSuppressKeyEvents((Canvas)this, suppressKeyEvents);
    gameCanvasLF = new GameCanvasLFImpl(this);

    // Create and hand out game accessor tunnel instance
    if (gameAccess == null) {
        gameAccess = new GameAccessImpl();
        GameMap.registerGameAccess(gameAccess);
    }
}
 
Example #21
Source File: MicroLoader.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
public void applyConfiguration() {
	try {
		boolean cxShowKeyboard = params.getBoolean(("ShowKeyboard"), true);

		// Apply configuration to the launching MIDlet
		if (cxShowKeyboard) {
			setVirtualKeyboard();
		} else {
			ContextHolder.setVk(null);
		}
		setProperties();

		int fontSizeSmall = params.getInt("FontSizeSmall", 18);
		int fontSizeMedium = params.getInt("FontSizeSmall", 18);
		int fontSizeLarge = params.getInt("FontSizeLarge", 26);
		boolean fontApplyDimensions = params.getBoolean("FontApplyDimensions", false);

		int screenWidth = params.getInt("ScreenWidth", 240);
		int screenHeight = params.getInt("ScreenHeight", 320);
		int screenBackgroundColor = params.getInt("ScreenBackgroundColor", 0xD0D0D0);
		int screenScaleRatio = params.getInt("ScreenScaleRatio", 100);
		boolean screenScaleToFit = params.getBoolean("ScreenScaleToFit", true);
		boolean screenKeepAspectRatio = params.getBoolean("ScreenKeepAspectRatio", true);
		boolean screenFilter = params.getBoolean("ScreenFilter", false);
		boolean immediateMode = params.getBoolean("ImmediateMode", false);
		boolean touchInput = params.getBoolean(("TouchInput"), true);
		boolean hwAcceleration = params.getBoolean("HwAcceleration", false);
		boolean parallel = params.getBoolean("ParallelRedrawScreen", false);
		boolean forceFullScreen = params.getBoolean("ForceFullscreen", false);
		boolean showFps = params.getBoolean("ShowFps", false);
		boolean limitFps = params.getBoolean("LimitFps", false);
		int fpsLimit = params.getInt("FpsLimit", 0);
		int layout = params.getInt("Layout", 0);

		Font.setSize(Font.SIZE_SMALL, fontSizeSmall);
		Font.setSize(Font.SIZE_MEDIUM, fontSizeMedium);
		Font.setSize(Font.SIZE_LARGE, fontSizeLarge);
		Font.setApplyDimensions(fontApplyDimensions);

		final String[] propLines = params.getString("SystemProperties", "").split("\n");
		for (String line : propLines) {
			String[] prop = line.split(":[ ]*", 2);
			if (prop.length == 2) {
				System.setProperty(prop[0], prop[1]);
			}
		}

		SparseIntArray intArray = KeyMapper.getArrayPref(params);
		Displayable.setVirtualSize(screenWidth, screenHeight);
		Canvas.setScale(screenScaleToFit, screenKeepAspectRatio, screenScaleRatio);
		Canvas.setFilterBitmap(screenFilter);
		EventQueue.setImmediate(immediateMode);
		Canvas.setHardwareAcceleration(hwAcceleration, parallel);
		Canvas.setBackgroundColor(screenBackgroundColor);
		Canvas.setKeyMapping(layout, intArray);
		Canvas.setHasTouchInput(touchInput);
		Canvas.setForceFullscreen(forceFullScreen);
		Canvas.setShowFps(showFps);
		Canvas.setLimitFps(limitFps, fpsLimit);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #22
Source File: MIDPVideoRenderer.java    From pluotsorbet with GNU General Public License v2.0 4 votes vote down vote up
public Object initDisplayMode(int mode, Object container) {
    if (this.mode != -1)
        throw new IllegalStateException("mode is already set");
    
    if (mode == USE_DIRECT_VIDEO) {
        if (!(container instanceof Canvas))
            throw new IllegalArgumentException(
                "container needs to be a Canvas for USE_DIRECT_VIDEO mode");
        
        if (mmHelper == null) {
            mmHelper = MMHelper.getMMHelper();
            if (mmHelper == null)
                throw new IllegalArgumentException(
                        "unable to set USE_DIRECT_VIDEO mode");
        }

        this.mode = mode;
        fsmode = false;
        cvis = true;
        canvas = (Canvas) container;
        mmHelper.registerPlayer(canvas, this);
        setVisible(false); // By default video is not shown in USE_DIRECT_VIDEO mode
        return null;
        
    } else if (mode == USE_GUI_PRIMITIVE) {
        if (container != null && 
            (!(container instanceof String) ||
             !(container.equals("javax.microedition.lcdui.Item"))))
            throw new IllegalArgumentException("container needs to be a javax.microedition.lcdui.Item for USE_GUI_PRIMITIVE mode");

        this.mode = mode;
        fsmode = false;
        cvis = true;
        mmItem = new MMItem();
        setVisible(true);
        return mmItem;
        
    } else {
        throw new IllegalArgumentException("unsupported mode");
    }
}
 
Example #23
Source File: VirtualKeyboard.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
@Override
public void setTarget(Canvas canvas) {
	target = canvas;
	repeater.setTarget(canvas);
	highlightGroup(-1);
}
 
Example #24
Source File: VirtualKeyboard.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
public VirtualKeyboard(int variant) {
	keypad = new VirtualKey[KEYBOARD_SIZE];
	associatedKeys = new VirtualKey[10]; // the average user usually has no more than 10 fingers...

	for (int i = KEY_NUM1; i < 9; i++) {
		keypad[i] = new VirtualKey(Canvas.KEY_NUM1 + i, Integer.toString(1 + i));
	}

	keypad[KEY_NUM0] = new VirtualKey(Canvas.KEY_NUM0, "0");
	keypad[KEY_STAR] = new VirtualKey(Canvas.KEY_STAR, "*");
	keypad[KEY_POUND] = new VirtualKey(Canvas.KEY_POUND, "#");

	keypad[KEY_SOFT_LEFT] = new VirtualKey(Canvas.KEY_SOFT_LEFT, "L");
	keypad[KEY_SOFT_RIGHT] = new VirtualKey(Canvas.KEY_SOFT_RIGHT, "R");

	keypad[KEY_DIAL] = new VirtualKey(Canvas.KEY_SEND, "D");
	keypad[KEY_CANCEL] = new VirtualKey(Canvas.KEY_END, "C");

	keypad[KEY_UP_LEFT] = new VirtualKey(Canvas.KEY_UP, Canvas.KEY_LEFT, ARROW_UP_LEFT);
	keypad[KEY_UP] = new VirtualKey(Canvas.KEY_UP, ARROW_UP);
	keypad[KEY_UP_RIGHT] = new VirtualKey(Canvas.KEY_UP, Canvas.KEY_RIGHT, ARROW_UP_RIGHT);

	keypad[KEY_LEFT] = new VirtualKey(Canvas.KEY_LEFT, ARROW_LEFT);
	keypad[KEY_RIGHT] = new VirtualKey(Canvas.KEY_RIGHT, ARROW_RIGHT);

	keypad[KEY_DOWN_LEFT] = new VirtualKey(Canvas.KEY_DOWN, Canvas.KEY_LEFT, ARROW_DOWN_LEFT);
	keypad[KEY_DOWN] = new VirtualKey(Canvas.KEY_DOWN, ARROW_DOWN);
	keypad[KEY_DOWN_RIGHT] = new VirtualKey(Canvas.KEY_DOWN, Canvas.KEY_RIGHT, ARROW_DOWN_RIGHT);

	keypad[KEY_FIRE] = new VirtualKey(Canvas.KEY_FIRE, "F");

	snapOrigins = new int[keypad.length];
	snapModes = new int[keypad.length];
	snapOffsets = new PointF[keypad.length];
	snapValid = new boolean[keypad.length];
	snapStack = new int[keypad.length];

	resetLayout(variant);
	layoutEditMode = LAYOUT_EOF;
	visible = true;
	hider = new Thread(this, "MIDletVirtualKeyboard");
	hider.start();
	repeater = new KeyRepeater();
}
 
Example #25
Source File: ExtendedImage.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
public void blitToScreen(int x, int y) {
	bufferGraphics.setColorAlpha(0);
	bufferGraphics.fillRect(0, 0, width, height);
	bufferGraphics.drawImage(image, x, y, 0);
	((Canvas) Display.getDisplay(null).getCurrent()).flushBuffer(buffer);
}
 
Example #26
Source File: GameCanvasImplementation.java    From CodenameOne with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Allows subclasses to access the canvas
 * 
 * @returns the canvas instance
 */
protected final Canvas getCanvas() {
    return canvas;
}
 
Example #27
Source File: GameCanvas.java    From pluotsorbet with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set a private field in the <code>Canvas</code> object. We use a
 * native method to work around the package boundary.
 * @param c this <code>GameCanvas</code> cast to a <code>Canvas</code>
 * @param suppressKeyEvents whether or not to suppress key events
 */
private native void setSuppressKeyEvents(Canvas c,
                                         boolean suppressKeyEvents);
 
Example #28
Source File: GameCanvasImplementation.java    From CodenameOne with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Allows a subclass to create its own canvas implemention
 * 
 * @return the canvas implementation
 */
protected Canvas createCanvas() {
    return new C();
}
 
Example #29
Source File: Overlay.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Target the overlay at the specified Canvas
 *
 * @param canvas Canvas, which, if necessary, should handle key pressings and pointer movement
 */
public void setTarget(Canvas canvas);