Code sample: Displaying an image for zooming and panning

import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.extension.container.*;

public class ZoomableImageApp extends UiApplication
{
     public static void main(String[] args) 
     {
          ZoomableImageApp theApp = new ZoomableImageApp();
          theApp.enterEventDispatcher();
     }

     public ZoomableImageApp()
     {
          EncodedImage myImg = EncodedImage.getEncodedImageResource("myImg.jpg");
          ZoomScreen zoomableImg = new ZoomScreen(myImg);
          pushScreen(zoomableImg);
     }
}

Was this information helpful? Send us your comments.