Class FishWorld

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--FishWorld
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class FishWorld
extends java.applet.Applet
implements java.lang.Runnable

FishWorld, a point and click game with fishes
Copyright (c) 2001,2002 by Stephan Uhlmann <su@su2.info>
published under the GPL

See Also:
Serialized Form

Inner Class Summary
(package private)  class FishWorld.FishWorldKeyAdapter
          KeyAdapter for receiving the KeyEvent's we need
(package private)  class FishWorld.FishWorldMouseAdapter
          MouseAdapter for receiving the MouseEvent's we need
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  java.awt.Image bg01
           
(package private)  java.awt.Image bg02
           
(package private)  java.awt.Image bg03
           
(package private)  java.awt.Image bg04
           
(package private)  java.awt.Image bg11
           
(package private)  java.awt.Image bg12
           
(package private)  java.awt.Image bg13
           
(package private)  java.awt.Image bg14
           
(package private)  java.util.Vector bubImages
           
(package private)  int clickLock
           
(package private)  java.awt.Graphics dbGraphics
           
(package private)  java.awt.Image dbImage
           
(package private)  int dynamiteCount
           
(package private)  java.awt.Image dynamiteImage
           
(package private)  java.util.Vector fishes
           
(package private)  java.util.Vector fishImages
           
static int GAME_STATE_AFTER_GAME
           
static int GAME_STATE_AFTER_GAME_HIGHSCORE
           
static int GAME_STATE_BEFORE_GAME
           
static int GAME_STATE_IN_GAME
           
static int GAME_STATE_LOADING
           
(package private)  int gameState
           
(package private)  Highscore highscore
           
(package private)  boolean keyPressed
           
(package private)  char keyPressedChar
           
(package private)  int loadProgress
           
(package private)  int mouseClickButton
           
(package private)  boolean mouseClicked
           
(package private)  int mouseClickX
           
(package private)  int mouseClickY
           
(package private)  java.awt.Color myBgColor
           
(package private)  java.awt.Color myFgColor
           
(package private)  java.awt.Font myFont
           
(package private)  java.lang.Thread myThread
           
(package private)  java.lang.String name
           
(package private)  int score
           
(package private)  boolean threadQuit
           
(package private)  boolean threadRunning
           
 
Fields inherited from class java.applet.Applet
accessibleContext, serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FishWorld()
           
 
Method Summary
 void checkFishKill()
          checks if a mouse click hit a fish and changes score then
 void drawFishes(java.awt.Graphics g)
          draws the fishes
 java.lang.String getAppletInfo()
          returns info about this applet
 void init()
          initializes the applet
 void loadGraphics()
          loads the graphics, increments loadProgress and calls repaint() after every loaded image (to display progress bar)
 void moveFishes()
          moves the fishes around and checks if a fish arrived at the other side
 void newFish()
          creates a new Fish and adds him to the fishes Vector
 void paint(java.awt.Graphics g)
          paints the Applet, just calls update()
 void run()
          runs the Applet Thread, loops infinite until theadQuit is set to true
 void start()
          starts applet by forking a new Thread of ourself and starting this Thread
 void stop()
          stops the Applet Thread by setting threadQuit to true and waiting until the Thread exists its run loop
 void update(java.awt.Graphics g)
          paints the Applet depending from current gameState, uses double buffering
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, setLayout, transferFocus, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

myThread

java.lang.Thread myThread

threadRunning

boolean threadRunning

threadQuit

boolean threadQuit

dbImage

java.awt.Image dbImage

dbGraphics

java.awt.Graphics dbGraphics

myFgColor

java.awt.Color myFgColor

myBgColor

java.awt.Color myBgColor

myFont

java.awt.Font myFont

mouseClicked

boolean mouseClicked

mouseClickX

int mouseClickX

mouseClickY

int mouseClickY

mouseClickButton

int mouseClickButton

clickLock

int clickLock

keyPressed

boolean keyPressed

keyPressedChar

char keyPressedChar

fishes

java.util.Vector fishes

fishImages

java.util.Vector fishImages

bubImages

java.util.Vector bubImages

bg01

java.awt.Image bg01

bg02

java.awt.Image bg02

bg03

java.awt.Image bg03

bg04

java.awt.Image bg04

bg11

java.awt.Image bg11

bg12

java.awt.Image bg12

bg13

java.awt.Image bg13

bg14

java.awt.Image bg14

dynamiteImage

java.awt.Image dynamiteImage

dynamiteCount

int dynamiteCount

score

int score

highscore

Highscore highscore

name

java.lang.String name

gameState

int gameState

loadProgress

int loadProgress

GAME_STATE_LOADING

public static final int GAME_STATE_LOADING

GAME_STATE_BEFORE_GAME

public static final int GAME_STATE_BEFORE_GAME

GAME_STATE_IN_GAME

public static final int GAME_STATE_IN_GAME

GAME_STATE_AFTER_GAME_HIGHSCORE

public static final int GAME_STATE_AFTER_GAME_HIGHSCORE

GAME_STATE_AFTER_GAME

public static final int GAME_STATE_AFTER_GAME
Constructor Detail

FishWorld

public FishWorld()
Method Detail

getAppletInfo

public java.lang.String getAppletInfo()
returns info about this applet
Overrides:
getAppletInfo in class java.applet.Applet

init

public void init()
initializes the applet
Overrides:
init in class java.applet.Applet

start

public void start()
starts applet by forking a new Thread of ourself and starting this Thread
Overrides:
start in class java.applet.Applet

stop

public void stop()
stops the Applet Thread by setting threadQuit to true and waiting until the Thread exists its run loop
Overrides:
stop in class java.applet.Applet

run

public void run()
runs the Applet Thread, loops infinite until theadQuit is set to true
Specified by:
run in interface java.lang.Runnable

paint

public void paint(java.awt.Graphics g)
paints the Applet, just calls update()
Overrides:
paint in class java.awt.Container

update

public void update(java.awt.Graphics g)
paints the Applet depending from current gameState, uses double buffering
Overrides:
update in class java.awt.Container

loadGraphics

public void loadGraphics()
loads the graphics, increments loadProgress and calls repaint() after every loaded image (to display progress bar)

newFish

public void newFish()
creates a new Fish and adds him to the fishes Vector

drawFishes

public void drawFishes(java.awt.Graphics g)
draws the fishes

moveFishes

public void moveFishes()
moves the fishes around and checks if a fish arrived at the other side

checkFishKill

public void checkFishKill()
checks if a mouse click hit a fish and changes score then