|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--java.applet.Applet
|
+--CellLife
Our main applet class. Draw the creatures and manages their lives. Stores a list of creatures and a list of references to all the cells in the universe, to simplify collision detection. Keeps track of how much time has passed.
| Field Summary | |
protected tjhBuckets |
buckets
space-partitioning structure to speed collision detection |
protected java.util.Vector |
creatures
A list of the creatures currently alive. |
protected long |
generations
The number of creatures that have been born since the simulation started |
protected tjh2dVector |
limit
The world is a rectangle from (0,0) to (limit.x,limit,y) |
protected static int |
MAX_CREATURES
the maximum number of creatures in the world. |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
CellLife()
CellLife Class Constructor |
|
| Method Summary | |
void |
destroy()
|
java.lang.String |
getAppletInfo()
The getAppletInfo() method returns a string describing the applet's author, copyright date, or miscellaneous information. |
void |
init()
first-time initialization |
boolean |
mouseDown(java.awt.Event evt,
int x,
int y)
|
boolean |
mouseDrag(java.awt.Event evt,
int x,
int y)
|
boolean |
mouseUp(java.awt.Event evt,
int x,
int y)
|
void |
paint(java.awt.Graphics g)
CellLife Paint Handler |
void |
run()
|
void |
start()
|
void |
stop()
|
| Methods inherited from class java.applet.Applet |
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 |
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
paramString,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setCursor,
setFont,
setLayout,
update,
validate,
validateTree |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseEnter,
mouseExit,
mouseMove,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
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,
wait,
wait,
wait |
| Field Detail |
protected static final int MAX_CREATURES
protected java.util.Vector creatures
protected tjh2dVector limit
protected long generations
protected tjhBuckets buckets
| Constructor Detail |
public CellLife()
| Method Detail |
public java.lang.String getAppletInfo()
public void init()
public void destroy()
public void paint(java.awt.Graphics g)
public void start()
public void stop()
public void run()
public boolean mouseDown(java.awt.Event evt,
int x,
int y)
public boolean mouseDrag(java.awt.Event evt,
int x,
int y)
public boolean mouseUp(java.awt.Event evt,
int x,
int y)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||