ErrorScreen.java
上传用户:szyfpy
上传日期:2021-03-01
资源大小:240k
文件大小:3k
源码类别:

通讯/手机编程

开发平台:

Java

  1. // Copyright 2004 Nokia Corporation.
  2. //
  3. // THIS SOURCE CODE IS PROVIDED 'AS IS', WITH NO WARRANTIES WHATSOEVER,
  4. // EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS
  5. // FOR ANY PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE
  6. // OR TRADE PRACTICE, RELATING TO THE SOURCE CODE OR ANY WARRANTY OTHERWISE
  7. // ARISING OUT OF ANY PROPOSAL, SPECIFICATION, OR SAMPLE AND WITH NO
  8. // OBLIGATION OF NOKIA TO PROVIDE THE LICENSEE WITH ANY MAINTENANCE OR
  9. // SUPPORT. FURTHERMORE, NOKIA MAKES NO WARRANTY THAT EXERCISE OF THE
  10. // RIGHTS GRANTED HEREUNDER DOES NOT INFRINGE OR MAY NOT CAUSE INFRINGEMENT
  11. // OF ANY PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OWNED OR CONTROLLED
  12. // BY THIRD PARTIES
  13. //
  14. // Furthermore, information provided in this source code is preliminary,
  15. // and may be changed substantially prior to final release. Nokia Corporation
  16. // retains the right to make changes to this source code at
  17. // any time, without notice. This source code is provided for informational
  18. // purposes only.
  19. //
  20. // Nokia and Nokia Connecting People are registered trademarks of Nokia
  21. // Corporation.
  22. // Java and all Java-based marks are trademarks or registered trademarks of
  23. // Sun Microsystems, Inc.
  24. // Other product and company names mentioned herein may be trademarks or
  25. // trade names of their respective owners.
  26. //
  27. // A non-exclusive, non-transferable, worldwide, limited license is hereby
  28. // granted to the Licensee to download, print, reproduce and modify the
  29. // source code. The licensee has the right to market, sell, distribute and
  30. // make available the source code in original or modified form only when
  31. // incorporated into the programs developed by the Licensee. No other
  32. // license, express or implied, by estoppel or otherwise, to any other
  33. // intellectual property rights is granted herein.
  34. package example.btl2capecho;
  35. import javax.microedition.lcdui.Alert;
  36. import javax.microedition.lcdui.AlertType;
  37. import javax.microedition.lcdui.Display;
  38. import javax.microedition.lcdui.Displayable;
  39. import javax.microedition.lcdui.Image;
  40. import java.util.Timer;
  41. import java.util.TimerTask;
  42. class ErrorScreen
  43.     extends Alert
  44. {
  45.     private static Image image;
  46.     private static Display display;
  47.     private static ErrorScreen instance = null;
  48.     private ErrorScreen()
  49.     {
  50.         super("Error");
  51.         setType(AlertType.ERROR);
  52.         setTimeout(2000);
  53.         setImage(image);
  54.     }
  55.     static void init(Image img, Display disp)
  56.     {
  57.         image = img;
  58.         display = disp;
  59.     }
  60.     static void showError(String message, Displayable next)
  61.     {
  62.         if (instance == null)
  63.         {
  64.             instance = new ErrorScreen();
  65.         }
  66.         if (message == null)
  67.         {
  68.             message = "";
  69.         }
  70.         instance.setString(message);
  71.         display.setCurrent(instance, next);
  72.     }
  73. }