hi
I want to display a 300x300 px image into the canvas and then move it. I used this code, it works well, but I have a problem about the canvas size limit:

import javax.microedition.lcdui.*;
public class BigImage extends Canvas implements CommandListener {
private Image image1;
private int canvasY = getHeight();
private int canvasX = getWidth();
private int locateY = canvasY / 2;
private int locateX = canvasX / 2;
private int x = 0;
private int y = 0;
public BigImage() {
try {
image1 = Image.createImage("/BigImage.png");
}
catch (Exception e) {}
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
setCommandListener(this);
addCommand(new Command("Exit", Command.EXIT, 1));
}
public void commandAction(Command command, Displayable displayable) {
}
protected void paint(Graphics g) {
g.drawImage(image1,locateX + x,locateY + y,Graphics.HCENTER|Graphics.VCENTER);
}
protected void keyPressed (int keyCode) {
int action = getGameAction(keyCode);
switch (action) {
case Canvas.RIGHT:
x = x + 10;
repaint();
break;
case Canvas.LEFT:
x = x - 10;
repaint();
break;
case Canvas.UP:
y = y - 10;
repaint();
break;
case Canvas.DOWN:
y = y + 10;
repaint();
break;
}
}
}

I used the image center as the anchor point. variable x , y are used as image current position.
I don't know how to set image's corners as displayble position limit.
I mean the image must always cover all the canvas!
can you help me? code samples are welcome.
thanks

eml