AppFrame.java
上传用户:shengda799
上传日期:2007-01-10
资源大小:68k
文件大小:3k
源码类别:

图片显示

开发平台:

Java

  1. // AppFrame.java
  2. //
  3. // This software is Copyright 1998 by Mark Watson.
  4. // This software may be freely used for any purpose
  5. // and may be modified for any purpose as long as
  6. // you agree to the following:
  7. //
  8. // 1. Any bug fixes or enhancements that you make must be emailed
  9. //    back to Mark Watson (markw@markwatson.com) for possible
  10. //    inclusion in the source code base that is available at
  11. //    the web site www.markwatson.com (credit will be given
  12. //    to contributers).
  13. //
  14. // 2. This copyright notice must be kept with the source code
  15. //    and duplicated if you distribute a modified verison of
  16. //    this software in binary form.
  17. //
  18. // 3. You will not re-distribute the source code. Rather, any
  19. //    improvements to this program will be returned to Mark
  20. //    Watson so that there is always one source base at
  21. //    the web site www.markwatson.com (you may freely
  22. //    distribute compiled derived versions of this program
  23. //    without any restrictions as long as this entire
  24. //    copyright notice is reproduced with the application
  25. //    (e.g., in the 'help' or 'about' dialog box).
  26. //
  27. // 4. This software may not be used for any illegal purpose.
  28. //
  29. // 5. You take all responsibility for the use of this software:
  30. //
  31. // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  32. // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  35. // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  39. // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  40. // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  41. // SUCH DAMAGE.
  42. // FreeWare contributers:
  43. //
  44. //   Name                        Email (optional)
  45. //   ----                        ----------------
  46. //
  47. //
  48. import java.awt.*;
  49. import java.awt.event.*;
  50. class AppFrame extends Frame {
  51.   public AppFrame() {
  52.     super(); 
  53.     enableEvents(AWTEvent.WINDOW_EVENT_MASK);
  54.   }
  55.   
  56.   public void processEvent(AWTEvent evt) { // JDK 1.1
  57.     switch (evt.getID())  {
  58.     case Event.WINDOW_DESTROY:
  59.       System.exit(0);
  60.     default:
  61.       super.processEvent(evt);
  62.     }  
  63.   }
  64. }