ggz.ui
Class ClientApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by ggz.ui.ClientApplet
All Implemented Interfaces:
ServerListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.HyperlinkListener, javax.swing.RootPaneContainer

public class ClientApplet
extends javax.swing.JApplet
implements ServerListener, javax.swing.event.HyperlinkListener

See Also:
Serialized Form

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JLabel busyPanel
           
protected  javax.swing.JPanel footerPanel
           
protected static java.util.logging.Logger log
           
protected  LoginPanel loginPanel
           
protected  LoungePanel loungePanel
           
protected  javax.swing.JPanel mainPanel
           
protected static java.util.ResourceBundle messages
           
protected  RoomPanel roomPanel
           
protected  Server server
           
protected  javax.swing.JLabel totalPlayerCountLabel
           
 
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
ClientApplet()
           
 
Method Summary
protected  boolean getBooleanParameter(java.lang.String name, boolean defaultValue)
           
protected  java.awt.Color getGradientColor1()
           
protected  java.awt.Color getGradientColor2()
           
protected  int getIntParameter(java.lang.String name, int defaultValue)
          Reads integer string from applet parameter.
protected  java.lang.String getParameter(java.lang.String name, java.lang.String defaultValue)
          Utility method that wraps the Applet.getParameter() method supports default values for parameters that don't have a value.
 java.lang.String[][] getParameterInfo()
           
protected  java.awt.Image getWatermark()
           
protected  void handleException(java.lang.Throwable e)
           
 void hyperlinkUpdate(javax.swing.event.HyperlinkEvent event)
          Called when a HyperlinkLabel in the application is clicked.
 void init()
           
 void invokeAndWait(java.lang.Runnable doRun)
           
protected  void resetLogin()
           
 void server_channel_connected()
          Status event: a requested direct game connection has been established.
 void server_channel_fail(java.lang.String error)
          Error: Failure during setup of direct connection to game server.
 void server_channel_ready()
          Game channel is ready for read/write operations.
 void server_chat_fail(ErrorEventData data)
          Error: A chat message could not be sent.
 void server_connect_fail(java.lang.String error)
          Error: we have failed to connect to the server.
 void server_connected()
          We have just made a connection to the server.
 void server_enter_fail(ErrorEventData data)
          Error: we have tried to enter a room and failed.
 void server_enter_ok()
          We have successfully entered a room.
 void server_list_rooms()
          The room list arrived.
 void server_list_types()
          The list of game types is available.
 void server_logged_out()
          Logged out of the server.
 void server_login_fail(ErrorEventData data)
          Error: login failure.
 void server_login_ok()
          We have successfully logged in.
 void server_motd_loaded(MotdEventData data)
          The MOTD has been read from the server and can be displayed.
 void server_negotiate_fail(java.lang.String error)
          Error: negotiation failure.
 void server_negotiated()
          We have negotiated a connection to the server.
 void server_net_error(java.lang.String error)
          Error: a network (transmission) error occurred.
 void server_players_changed()
          The number of players on the server has changed.
 void server_protocol_error(java.lang.String error)
          Error: a communication protocol error occured.
 void server_rooms_changed()
          A room has either been added, deleted or set to "closed".
 void server_state_changed()
          The internal state of ggzcore has changed.
 void start()
           
 void stop()
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, 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, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final java.util.logging.Logger log

messages

protected static final java.util.ResourceBundle messages

server

protected Server server

totalPlayerCountLabel

protected javax.swing.JLabel totalPlayerCountLabel

mainPanel

protected javax.swing.JPanel mainPanel

footerPanel

protected javax.swing.JPanel footerPanel

loginPanel

protected LoginPanel loginPanel

loungePanel

protected LoungePanel loungePanel

busyPanel

protected javax.swing.JLabel busyPanel

roomPanel

protected RoomPanel roomPanel
Constructor Detail

ClientApplet

public ClientApplet()
Method Detail

init

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

start

public void start()
Overrides:
start in class java.applet.Applet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

getParameter

protected java.lang.String getParameter(java.lang.String name,
                                        java.lang.String defaultValue)
Utility method that wraps the Applet.getParameter() method supports default values for parameters that don't have a value.

Parameters:
name -
defaultValue -
Returns:

getIntParameter

protected int getIntParameter(java.lang.String name,
                              int defaultValue)
Reads integer string from applet parameter. See the Integer.decode() method for supported string formats.

Parameters:
name -
defaultValue -
Returns:
See Also:
Integer.decode(java.lang.String)

getBooleanParameter

protected boolean getBooleanParameter(java.lang.String name,
                                      boolean defaultValue)

getGradientColor1

protected java.awt.Color getGradientColor1()

getGradientColor2

protected java.awt.Color getGradientColor2()

getWatermark

protected java.awt.Image getWatermark()

server_channel_connected

public void server_channel_connected()
Description copied from interface: ServerListener
Status event: a requested direct game connection has been established. To start a game (table), a channel must be created. This event will alert that the channel has been established. The channel's FD should then be monitored for input, which should then be passed back to the server object for handling.

Specified by:
server_channel_connected in interface ServerListener
See Also:
ggzcore_server_get_channel, ggzcore_server_read_data

server_channel_fail

public void server_channel_fail(java.lang.String error)
Description copied from interface: ServerListener
Error: Failure during setup of direct connection to game server. If the channel could not be prepared, this event will happen instead of GGZ_CHANNEL_READY or GGZ_CHANNEL_CONNECTED event. At this point the channel is no longer useful (I think).

Specified by:
server_channel_fail in interface ServerListener
See Also:
ggzcore_server_read_data

server_channel_ready

public void server_channel_ready()
Description copied from interface: ServerListener
Game channel is ready for read/write operations. After the channel has been connected, if we continue to monitor the socket eventually it will be negotiated and ready to use. At this point it is ready for the game client to use.

Specified by:
server_channel_ready in interface ServerListener
See Also:
ggzcore_server_read_data

server_chat_fail

public void server_chat_fail(ErrorEventData data)
Description copied from interface: ServerListener
Error: A chat message could not be sent. This will happen when we try to send a chat and the server rejects it.

Specified by:
server_chat_fail in interface ServerListener
Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_read_data

server_connect_fail

public void server_connect_fail(java.lang.String error)
Description copied from interface: ServerListener
Error: we have failed to connect to the server. This is generated in place of GGZ_CONNECTED if the connection could not be made. The server object is otherwise unaffected.

Specified by:
server_connect_fail in interface ServerListener
See Also:
ggzcore_server_connect

server_connected

public void server_connected()
Description copied from interface: ServerListener
We have just made a connection to the server. After this point the server's socket should be accessible and should be monitored for data. It happens in direct response to ggzcore_server_connect. Note that most events after this will only happen by calling ggzcore_server_read_data on the server's FD!

Specified by:
server_connected in interface ServerListener
See Also:
ggzcore_server_connect

server_enter_fail

public void server_enter_fail(ErrorEventData data)
Description copied from interface: ServerListener
Error: we have tried to enter a room and failed. This will be issued to tell us a room join has failed.

Specified by:
server_enter_fail in interface ServerListener
Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_join_room, ggzcore_server_read_data

server_enter_ok

public void server_enter_ok()
Description copied from interface: ServerListener
We have successfully entered a room. This will be issued to tell us a room join has succeeded, after it has been requested.

Specified by:
server_enter_ok in interface ServerListener
See Also:
ggzcore_server_join_room, ggzcore_server_read_data

server_login_ok

public void server_login_ok()
Description copied from interface: ServerListener
We have successfully logged in. We can now start doing stuff. This will not happen until the client sends their login information.

Specified by:
server_login_ok in interface ServerListener
See Also:
ggzcore_server_login, ggzcore_server_read_data

server_login_fail

public void server_login_fail(ErrorEventData data)
Description copied from interface: ServerListener
Error: login failure. This will happen in place of GGZ_LOGGED_IN if the login failed. The server object will be otherwise unaffected.

Specified by:
server_login_fail in interface ServerListener
Parameters:
data - A pointer to a GGZErrorEventData.
See Also:
GGZErrorEventData, ggzcore_server_read_data

server_logged_out

public void server_logged_out()
Description copied from interface: ServerListener
Logged out of the server. This will happen when the server completes the communication; usually after ggzcore_net_send_logout is called.

Specified by:
server_logged_out in interface ServerListener
See Also:
ggzcore_server_read_data

server_motd_loaded

public void server_motd_loaded(MotdEventData data)
Description copied from interface: ServerListener
The MOTD has been read from the server and can be displayed. The server will send us the MOTD automatically after login; it can also be requested by ggzcore_server_motd. It is up to the client whether or not to display it. See the online documentation (somewhere?) about the MOTD markup format.

Specified by:
server_motd_loaded in interface ServerListener
Parameters:
data - Pointer to a GGZMotdEventData including the full MOTD text.
See Also:
ggzcore_server_motd, ggzcore_server_read_data!

server_negotiate_fail

public void server_negotiate_fail(java.lang.String error)
Description copied from interface: ServerListener
Error: negotiation failure. Could be the wrong version. This will happen in place of a GGZ_NEGOTIATED if the server could not be negotiated with.

Specified by:
server_negotiate_fail in interface ServerListener
See Also:
ggzcore_server_read_data

server_negotiated

public void server_negotiated()
Description copied from interface: ServerListener
We have negotiated a connection to the server. This will happen automatically once a connection has been established, if the server socket is monitored.

Specified by:
server_negotiated in interface ServerListener
See Also:
ggzcore_server_read_data

server_net_error

public void server_net_error(java.lang.String error)
Description copied from interface: ServerListener
Error: a network (transmission) error occurred. The server will automatically disconnect.

Specified by:
server_net_error in interface ServerListener
See Also:
ggzcore_server_read_data

server_protocol_error

public void server_protocol_error(java.lang.String error)
Description copied from interface: ServerListener
Error: a communication protocol error occured. This can happen in a variety of situations when the server sends us something we can't handle. The server will be automatically disconnected.

Specified by:
server_protocol_error in interface ServerListener
See Also:
ggzcore_server_read_data

server_list_rooms

public void server_list_rooms()
Description copied from interface: ServerListener
The room list arrived. This will only happen after the list is requested by ggzcore_server_list_rooms(). The list may be accessed through ggzcore_server_get_num_rooms() and ggzcore_server_get_nth_room(). Until this event arrives these functions will be useless!

Specified by:
server_list_rooms in interface ServerListener
See Also:
ggzcore_server_read_data

server_rooms_changed

public void server_rooms_changed()
Description copied from interface: ServerListener
A room has either been added, deleted or set to "closed".

Specified by:
server_rooms_changed in interface ServerListener

server_players_changed

public void server_players_changed()
Description copied from interface: ServerListener
The number of players on the server has changed. This event is issued rather frequently every time players enter or leave.

Specified by:
server_players_changed in interface ServerListener
See Also:
ggzcore_server_get_num_players, ggzcore_server_read_data

server_state_changed

public void server_state_changed()
Description copied from interface: ServerListener
The internal state of ggzcore has changed. This may happen at any time.

Specified by:
server_state_changed in interface ServerListener
See Also:
GGZStateID, ggzcore_server_get_state

server_list_types

public void server_list_types()
Description copied from interface: ServerListener
The list of game types is available. This will only happen after the list is requested by ggzcore_server_list_types(). The list may be accessed through ggzcore_server_get_num_gametypes() and ggzcore_server_get_nth_gametype(). Until this event arrives these functions will be useless!

Specified by:
server_list_types in interface ServerListener
See Also:
ggzcore_server_read_data

handleException

protected void handleException(java.lang.Throwable e)

resetLogin

protected void resetLogin()

hyperlinkUpdate

public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent event)
Called when a HyperlinkLabel in the application is clicked.

Specified by:
hyperlinkUpdate in interface javax.swing.event.HyperlinkListener
Parameters:
event -

invokeAndWait

public void invokeAndWait(java.lang.Runnable doRun)