How to scroll a SVGImage?

Im using JSR226 in my Final year Project.

I need 2 know how 2 scroll a SVGImage which is larger than screen size.

is it possible?

As a matter of fact, i have found and used some code for the same prob using the canvas and ordinary images plus i tried adding some Sprites as well (without JSR 226)

here's the code, So it ll be a great help if some can alter this code to accompanythe SVGImage :)

I need it ASAP, plz some1 help me :)

<code>

package View;

import Controller.*;

import java.io.IOException;

import javax.microedition.lcdui.*;

import javax.microedition.midlet.*;

import javax.microedition.lcdui.game.*;

public class ShowMap extends Canvas implements CommandListener {

Form form;

Command back;

Image imgPark;

Image imgZoo;

Sprite sprPark;

Sprite sprZoo;

int screenWidth = this.getWidth();

int screenHeight = this.getHeight();

int imageWidth;

int imageHeight;

int x;

int y;

int dx = 0;

int dy = 0;

Image mapImage;

Image screenBuff;

Image copy;

Graphics bufferGraphics;

Graphics imageGraphics;

Displayable prev;

MIDlet mdlMain;

public ShowMap() {

}

public ShowMap(MIDlet m,Displayable d, String RegionName) throws Exception{

mdlMain = m;

prev = d;

MapHandler mh = new MapHandler();

mapImage = mh.getRegionalMap(RegionName);

setScrollable(mapImage);

imgPark = Image.createImage("/Images/Symbols/park.png");

imgZoo = Image.createImage("/Images/Symbols/zoo.png");

sprPark = new Sprite(imgPark);

sprZoo = new Sprite(imgZoo);

this.setTitle(RegionName +" Map");

back = new Command("Back",Command.BACK,0);

this.addCommand(back);

this.setCommandListener(this);

}

private void setScrollable(Image mapImage){

imageWidth = mapImage.getWidth();

imageHeight = mapImage.getHeight();

x = (screenWidth - imageWidth)/ 2;

y = (screenHeight - imageHeight) / 2;

//copy.createImage(imageWidth,imageHeight);

screenBuff = Image.createImage(screenWidth, screenHeight);

bufferGraphics = screenBuff.getGraphics();

bufferGraphics.setColor(0,0,0);

bufferGraphics.fillRect(0,0,screenWidth,screenHeight);

}

public Canvas getDisplayable(){

return this;

}

public void commandAction(Command c, Displayable d) {

if(c==back){

Display.getDisplay(mdlMain).setCurrent(prev);

}

}

protected void paint(Graphics g) {

bufferGraphics.drawImage(mapImage,x,y,bufferGraphics.TOP|bufferGraphics.LEFT);

//imageGraphics.setStrokeStyle(Graphics.DOTTED);

//imageGraphics.drawLine(10,10,50,50);

g.drawImage(screenBuff,0,0,Graphics.TOP|Graphics.LEFT);

sprPark.setRefPixelPosition(10,20);

sprPark.paint(g);

//g.drawString("tesing",x,y,Graphics.TOP|Graphics.LEFT);

}

protected void moveImage(int key){

switch(key){

case -1:

if (y < 0) y++;

break;

case -2:

if (y > screenHeight - imageHeight) y--;

break;

case -3:

if (x < 0) x++;

break;

case -4:

if (x > screenWidth - imageWidth) x--;

break;

}

repaint();

}

protected void keyPressed(int keyCode) {

moveImage(keyCode);

}

[3455 byte] By [muhammedha] at [2007-11-26 18:49:29]
# 1
:Dtrace your code where the error occur. then post the error part. only suggestion dude..
ringoputaa at 2007-7-9 6:23:31 > top of Java-index,Java Mobility Forums,Java ME Technologies...