Draw image to the bottom and right : Image « J2ME « Java Tutorial

import java.io.IOException;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;

public class ImageBottomRightGraphicsMIDlet extends MIDlet {
  private Display display;

  protected void startApp() {
    Canvas canvas = new LineCanvas();
    display = Display.getDisplay(this);

  protected void pauseApp() {

  protected void destroyApp(boolean unconditional) {

class LineCanvas extends Canvas {
  public void paint(Graphics g) {
    int width = getWidth();
    int height = getHeight();
    try {
      Image image = Image.createImage("/h.png");
      g.drawImage(image, width, height, Graphics.BOTTOM | Graphics.RIGHT);
    } catch (IOException ex) {
      g.drawString("Failed to load image!", 0, 0, Graphics.TOP | Graphics.LEFT);

31.35.1.Draw image
31.35.2.Draw image to the bottom and right
31.35.3.Draw image to the center vertically and horizontally
31.35.4.Draw image with rectangle
31.35.5.Display big Image
31.35.6.Immutable image
31.35.7.Mutable ImageMutable Image
31.35.8.Image loading exception