【问题标题】:j2me splash screenj2me 闪屏
【发布时间】:2009-06-17 16:13:53
【问题描述】:

如何为我的 j2me 应用程序构建基于图像的启动画面?

我已经有一个应用程序,我需要一个启动屏幕来附加它。

【问题讨论】:

    标签: java-me splash-screen


    【解决方案1】:

    J2ME 没有默认的“启动画面”方法,它只显示一张图片几秒钟,然后继续下一个显示。如果你真的想要,你可以利用这段时间在后台加载一些其他的东西。

    This is a tutorial by Sun on splash screens

    【讨论】:

      【解决方案2】:

      你可以这样使用:

      class SplashScreenSwitcher extends Thread {  
      
          private Display display;
          private Displayable splashScreen;
          private Displayable nextScreen;
      
          public SplashScreenSwitcher(Display display, Displayable splashScreen, Displayable nextScreen) {
               this.display = display;
               this.splashScreen = splashScreen;
               this.nextScreen = nextScreen;
          }
      
          public void run() {
               display.setCurrent(splashScreen);
               try {
                    Thread.sleep(2000); //Here you set needed time or make a constant
               } catch (Exception ex) {}
               display.setCurrent(nextScreen);
          }
      }
      

      所以,你要做的只是创建这个类的一个新实例并启动线程。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-09-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多