|
||||||||
| 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
fang.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 |
|---|
JApplet.AccessibleJApplet |
| Nested classes/interfaces inherited from class java.applet.Applet |
|---|
Applet.AccessibleApplet |
| Nested classes/interfaces inherited from class java.awt.Panel |
|---|
Panel.AccessibleAWTPanel |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected CardLayout |
cards
the layout for the applet/application |
protected FunButton |
connectButton
|
protected Container |
container
the container need for flipping cards |
protected boolean |
createOwnFrame
determines if the game should have its own frame |
static boolean |
displayControlButtons
|
protected JFrame |
frame
frame for the GUI |
boolean |
fullScreen
determines if the game will be displayed full screen or not. |
protected HTMLDisplay |
help
display for help information |
protected ButtonSprite |
helpPlay
control buttons |
protected JLabel |
loadingMessage
the message displayed while loading |
protected ButtonSprite |
mute
control buttons |
protected ButtonSprite |
pause
control buttons |
int |
players
the number of players |
boolean |
playersSelectable
the ability to change the number of players |
protected JTextField |
playersSpinner
input component for the number of players |
protected ButtonSprite |
quit
control buttons |
protected JTextField |
serverField
input component for the server name |
protected JTextField |
serverLabel
labels for connecting in multiplayer games |
boolean |
serverSelectable
the ability to change the server name |
protected FunComboBox |
sessionComboBox
input component for the session name |
protected JTextField |
sessionLabel
labels for connecting in multiplayer games |
boolean |
sessionSelectable
the ability to change the session name |
protected 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(ActionEvent e)
responds to control button presses |
abstract void |
begin()
starts the game. |
abstract void |
disconnect()
abstract method, disconnects |
abstract AnimationCanvas |
getCanvas()
abstract method to return canvas |
protected Dimension |
getDefaultSize()
if the size is not specified it is 400 x 400 |
abstract String |
getGameName()
gets the name of the game |
String |
getHash()
hashes the compiled source code in order to make sure that the only game which one can connect to is the exact same game. |
protected URL |
getHelpStyleSheet()
gets the stylesheet to format the help screen. |
static String |
getHostname()
gets the name of the localhost on the network |
abstract String |
getServerName()
gets the name of the server to connect to when joining a game. |
abstract String |
getSessionName()
gets the name of the session. |
void |
init()
sets the frame visible |
protected boolean |
isCreatingOwnFrame()
|
protected void |
pauseToggle()
toggles pause |
void |
runAsApplication()
runs as an application. |
protected void |
setCreateOwnFrame(boolean createOwnFrame)
Set the createOwnFrame field; true means that when the GameWindow is created,
it will create its own top-level window. |
protected void |
setDefaultHelp()
sets the default help screen to say that the player should email the author of the game asking him/her to make a help screen |
abstract void |
setGameName(String name)
abstract method, sets the name of the game |
void |
setHelp(String filename)
this method must be called in order to set the help screen. |
void |
setHelpText(String helpText)
|
void |
setLoadMessage(String message)
sets a custom loading message |
abstract void |
setNumberOfPlayers(int players)
sets the number of players to wait for when starting a new game. |
abstract void |
setServerName(String server)
where this game's server resides |
abstract void |
setSessionName(String session)
sets the name of this particular instance of the game |
void |
setTitle(String topTitle)
Sets the title at the top of the JFrame and/or applet |
abstract void |
startGame()
abstract method, starts game |
void |
stop()
sets the frame invisible and pauses the game |
protected void |
toggleAudible()
toggles the sound between on and muted |
void |
windowStateChanged(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.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected JFrame frame
protected JLabel loadingMessage
protected JTextField sessionLabel
protected JTextField serverLabel
protected CardLayout cards
protected Container container
protected ButtonSprite pause
protected ButtonSprite quit
protected ButtonSprite helpPlay
protected ButtonSprite mute
protected FunButton connectButton
protected FunComboBox sessionComboBox
protected JTextField serverField
protected JTextField playersSpinner
protected JLabel title
protected HTMLDisplay help
protected boolean createOwnFrame
public int players
public boolean playersSelectable
public boolean serverSelectable
public boolean sessionSelectable
public static boolean displayControlButtons
public boolean fullScreen
| Constructor Detail |
|---|
public GameWindow()
| Method Detail |
|---|
protected void setCreateOwnFrame(boolean createOwnFrame)
GameWindow is created,
it will create its own top-level window. Set by the constructor and runAsApplication.
Note; this has no meaning after init is called.
createOwnFrame - should the GameWindow create its own top-level window/frame and embed itself there?
true means create own frame; false means use applet space set aside in browserprotected boolean isCreatingOwnFrame()
public void runAsApplication()
public abstract void setGameName(String name)
name - name of gamepublic abstract String getGameName()
public void setTitle(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(String server)
server - the name of the computer
where the game was originally startedpublic abstract void setSessionName(String session)
session - the name of this particular instance of the gamepublic void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenerprotected void toggleAudible()
public abstract void disconnect()
protected void pauseToggle()
public void setHelp(String filename)
filename - the relative file name
of the help html filepublic void setHelpText(String helpText)
protected void setDefaultHelp()
protected URL getHelpStyleSheet()
protected Dimension getDefaultSize()
public void windowStateChanged(WindowEvent event)
windowStateChanged in interface WindowStateListenerWindowStateListener.windowStateChanged(java.awt.event.WindowEvent)public abstract String getSessionName()
public abstract String getServerName()
public static String getHostname()
public abstract AnimationCanvas getCanvas()
public void setLoadMessage(String message)
message - the text for the JLabelpublic abstract void begin()
public String getHash()
public void init()
init in class Appletpublic abstract void startGame()
public void stop()
stop in class Applet
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||