001 package com.croftsoft.apps.zombie; 002 003 import java.awt.*; 004 import java.awt.event.*; 005 import javax.swing.*; 006 007 import com.croftsoft.core.gui.FrameLib; 008 import com.croftsoft.core.lang.ClassLib; 009 import com.croftsoft.core.lang.lifecycle.Lifecycle; 010 import com.croftsoft.core.animation.AnimatedComponent; 011 012 /********************************************************************* 013 * Zombie Hunter. 014 * 015 * @version 016 * 2003-02-18 017 * @since 018 * 2002-02-25 019 * @author 020 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 021 *********************************************************************/ 022 023 public final class Zombie 024 extends JApplet 025 implements Lifecycle, ZombieConstants 026 ////////////////////////////////////////////////////////////////////// 027 ////////////////////////////////////////////////////////////////////// 028 { 029 030 private AnimatedComponent animatedComponent; 031 032 ////////////////////////////////////////////////////////////////////// 033 ////////////////////////////////////////////////////////////////////// 034 035 public static void main ( String [ ] args ) 036 ////////////////////////////////////////////////////////////////////// 037 { 038 JFrame jFrame = new JFrame ( FRAME_TITLE ); 039 040 try 041 { 042 jFrame.setIconImage ( ClassLib.getResourceAsImage ( 043 Zombie.class, FRAME_ICON_FILENAME ) ); 044 } 045 catch ( Exception ex ) 046 { 047 } 048 049 Zombie zombie = new Zombie ( ); 050 051 jFrame.setContentPane ( zombie ); 052 053 FrameLib.launchJFrameAsDesktopApp ( 054 jFrame, 055 new Lifecycle [ ] { zombie }, 056 FRAME_SIZE, 057 SHUTDOWN_CONFIRMATION_PROMPT ); 058 } 059 060 ////////////////////////////////////////////////////////////////////// 061 ////////////////////////////////////////////////////////////////////// 062 063 public String getAppletInfo ( ) 064 ////////////////////////////////////////////////////////////////////// 065 { 066 return INFO; 067 } 068 069 ////////////////////////////////////////////////////////////////////// 070 // interface Lifecycle methods 071 ////////////////////////////////////////////////////////////////////// 072 073 public void init ( ) 074 ////////////////////////////////////////////////////////////////////// 075 { 076 System.out.println ( INFO ); 077 078 animatedComponent 079 = new ZombieReanimator ( ).getAnimatedComponent ( ); 080 081 Container contentPane = getContentPane ( ); 082 083 contentPane.setLayout ( new BorderLayout ( ) ); 084 085 contentPane.add ( animatedComponent, BorderLayout.CENTER ); 086 087 validate ( ); 088 089 animatedComponent.init ( ); 090 } 091 092 public void start ( ) { animatedComponent.start ( ); } 093 094 public void stop ( ) { animatedComponent.stop ( ); } 095 096 public void destroy ( ) { animatedComponent.destroy ( ); } 097 098 ////////////////////////////////////////////////////////////////////// 099 ////////////////////////////////////////////////////////////////////// 100 }