`
wuhua
  • 浏览: 2092217 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Display an image for zooming and panning

阅读更多

  1.  Import the required classes and interfaces:
    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.*;
  2.  Create the application framework by extending the UiApplication class. In main(), create an instance of the new class and invoke enterEventDispatcher() to enable the application to receive events. In the constructor, create an EncodedImage using a resource in your project, create aZoomScreen with the EncodedImage, and invoke pushScreen() to display the image for zooming and panning.
    public class ZoomableImageApp extends UiApplication
    {
         public static void main(String[] args) 
         {
              ZoomableImageApp theApp = new ZoomableImageApp();
              theApp.enterEventDispatcher();
         }
    
         public ZoomableImageApp() 
         {
              EncodedImage myImg = new EncodedImage("myImg.jpg");
              ZoomScreen zoomableImg = new ZoomScreen(myImg);
              pushScreen(zoomableImg);
         }
    }

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 = new EncodedImage("myImg.jpg");
          ZoomScreen zoomableImg = new ZoomScreen(myImg);
          pushScreen(zoomableImg);
     }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics