|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
javax.swing.JApplet
tipgame.GameWindow
public abstract class GameWindow
Driver for the GameLoop. Extending this class will put the AnimationCanvas of the the GameLoop into a JFrame with controls at the bottom for starting/pausing, muting, showing a help screen, and quitting.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JApplet |
|---|
javax.swing.JApplet.AccessibleJApplet |
| Nested classes/interfaces inherited from class java.applet.Applet |
|---|
java.applet.Applet.AccessibleApplet |
| Nested classes/interfaces inherited from class java.awt.Panel |
|---|
java.awt.Panel.AccessibleAWTPanel |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected javax.swing.JFrame |
frame
frame for the GUI |
protected GameLoop |
gameLoop
the GameLoop containing the animation canvas |
protected boolean |
hasFrame
determines if the game should have its own frame |
protected HTMLDisplay |
help
display for help information |
(package private) javax.swing.JButton |
helpPlay
control buttons |
(package private) javax.swing.JButton |
mute
control buttons |
(package private) javax.swing.JButton |
pause
control buttons |
(package private) javax.swing.JButton |
quit
control buttons |
(package private) javax.swing.JLabel |
title
title at the top of the frame |
| Fields inherited from class javax.swing.JApplet |
|---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
GameWindow()
makes the components, layout, and sets the name of the game |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
responds to control button presses |
abstract void |
disconnect()
abstract method, disconnects |
private void |
exitGame()
quits the application |
abstract AnimationCanvas |
getCanvas()
abstract method to return canvas |
private javax.swing.JPanel |
getControlPanel()
layout the bottom control panel |
protected java.awt.Dimension |
getDefaultSize()
if the size is not specified it is 600 x 600 |
protected abstract java.net.URL |
getHelpURL()
this method must be overridden when extending the GameWindow. |
void |
init()
sets the frame visible |
private void |
layoutComponents()
position all components |
private void |
makeComponents()
initialize all components |
void |
pauseToggle()
toggles pause |
void |
runAsApplication()
runs as an application |
abstract void |
setGameName(java.lang.String name)
abstract method, sets the name of the game |
abstract void |
setNumberOfPlayers(int players)
sets the number of players to wait for when starting a new game. |
abstract void |
setServerName(java.lang.String server)
where this game's server resides |
abstract void |
setSessionName(java.lang.String session)
sets the name of this particular instance of the game |
void |
setTitle(java.lang.String topTitle)
Sets the title at the top of the JFrame |
void |
setUseFrame(boolean hasFrame)
sets hasFrame to parameter hasFrame |
abstract void |
startGame()
abstract method, starts game |
void |
stop()
sets the frame invisible and pauses the game |
void |
toggleAudible()
toggles the sound |
void |
windowStateChanged(java.awt.event.WindowEvent event)
exits the application when the window closes and also terminates the server connections |
| Methods inherited from class javax.swing.JApplet |
|---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.applet.Applet |
|---|
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start |
| Methods inherited from class java.awt.Panel |
|---|
addNotify |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected javax.swing.JFrame frame
javax.swing.JButton pause
javax.swing.JButton quit
javax.swing.JButton helpPlay
javax.swing.JButton mute
protected GameLoop gameLoop
javax.swing.JLabel title
protected HTMLDisplay help
protected boolean hasFrame
| Constructor Detail |
|---|
public GameWindow()
| Method Detail |
|---|
public void setUseFrame(boolean hasFrame)
hasFrame - public void runAsApplication()
public abstract void setGameName(java.lang.String name)
name - name of gamepublic void setTitle(java.lang.String topTitle)
topTitle - the text for the titlepublic abstract void setNumberOfPlayers(int players)
players - the number of players to wait for before starting the gamepublic abstract void setServerName(java.lang.String server)
server - the name of the computer where the game was originally startedpublic abstract void setSessionName(java.lang.String session)
session - the name of this particular instance of the gamepublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic void toggleAudible()
private void exitGame()
public abstract void disconnect()
public void pauseToggle()
protected abstract java.net.URL getHelpURL()
protected java.awt.Dimension getDefaultSize()
public void windowStateChanged(java.awt.event.WindowEvent event)
windowStateChanged in interface java.awt.event.WindowStateListenerWindowStateListener.windowStateChanged(java.awt.event.WindowEvent)private void makeComponents()
private void layoutComponents()
public abstract AnimationCanvas getCanvas()
private javax.swing.JPanel getControlPanel()
public void init()
init in class java.applet.Appletpublic abstract void startGame()
public void stop()
stop in class java.applet.Applet
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||