JSettlers v1.0.6 API
Built ${date}

soc.client
Class SOCAccountClient

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended bysoc.client.SOCAccountClient
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class SOCAccountClient
extends java.applet.Applet
implements java.lang.Runnable, java.awt.event.ActionListener

Applet/Standalone client for connecting to the SOCServer and making user accounts. If you want another connection port, you have to specify it as the "port" argument in the html source. If you run this as a stand-alone, you have to specify the port.

Author:
Robert S Thomas
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.applet.AppletContext ac
           
protected  java.awt.CardLayout cardLayout
           
protected  boolean connected
           
protected  java.awt.TextField email
           
protected  java.lang.String emailAddress
          the email address
protected  java.lang.Exception ex
           
protected  java.lang.String host
           
protected  java.io.DataInputStream in
           
protected  java.awt.Label messageLabel
           
protected  java.awt.TextField nick
           
protected  java.lang.String nickname
          the nickname
protected  java.io.DataOutputStream out
           
protected  java.awt.TextField pass
           
protected  java.awt.TextField pass2
           
protected  java.lang.String password
          the password
protected  java.lang.String password2
          the second password
protected  int port
           
protected  java.lang.Thread reader
           
protected  java.net.Socket s
           
protected  java.awt.TextField status
           
protected  java.awt.Button submit
           
protected  boolean submitLock
           
 
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
SOCAccountClient()
          Create a SOCAccountClient connecting to localhost port 8880
SOCAccountClient(java.lang.String h, int p)
          Constructor for connecting to the specified host, on the specified port.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handle mouse clicks and keyboard
 void connect()
          Attempts to connect to the server.
 void destroy()
          destroy the applet
protected  void disconnect()
          disconnect from the net
 java.lang.String getAppletInfo()
          applet info
 int getHexParameter(java.lang.String name)
          Retrieve a parameter and translate to a hex value.
protected  void handleCHANNELS(SOCChannels mes)
          handle the "list of channels" message
protected  void handleREJECTCONNECTION(SOCRejectConnection mes)
          handle the "reject connection" message
protected  void handleSTATUSMESSAGE(SOCStatusMessage mes)
          handle the "status message" message
 void init()
          Initialize the applet
protected  void initVisualElements()
          init the visual elements
static void main(java.lang.String[] args)
          for stand-alones
 boolean put(java.lang.String s)
          write a message to the net
 void run()
          continuously read from the net in a separate thread
 void treat(SOCMessage mes)
          Treat the incoming messages
static void usage()
          for stand-alones
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, 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, 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, isOpaque, 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, setName, 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

nick

protected java.awt.TextField nick

pass

protected java.awt.TextField pass

pass2

protected java.awt.TextField pass2

email

protected java.awt.TextField email

status

protected java.awt.TextField status

submit

protected java.awt.Button submit

messageLabel

protected java.awt.Label messageLabel

ac

protected java.applet.AppletContext ac

submitLock

protected boolean submitLock

cardLayout

protected java.awt.CardLayout cardLayout

host

protected java.lang.String host

port

protected int port

s

protected java.net.Socket s

in

protected java.io.DataInputStream in

out

protected java.io.DataOutputStream out

reader

protected java.lang.Thread reader

ex

protected java.lang.Exception ex

connected

protected boolean connected

nickname

protected java.lang.String nickname
the nickname


password

protected java.lang.String password
the password


password2

protected java.lang.String password2
the second password


emailAddress

protected java.lang.String emailAddress
the email address

Constructor Detail

SOCAccountClient

public SOCAccountClient()
Create a SOCAccountClient connecting to localhost port 8880


SOCAccountClient

public SOCAccountClient(java.lang.String h,
                        int p)
Constructor for connecting to the specified host, on the specified port. Must call 'init' to start up and do layout.

Parameters:
h - host
p - port
Method Detail

initVisualElements

protected void initVisualElements()
init the visual elements


getHexParameter

public int getHexParameter(java.lang.String name)
Retrieve a parameter and translate to a hex value.

Parameters:
name - a parameter name. null is ignored
Returns:
the parameter parsed as a hex value or -1 on error

init

public void init()
Initialize the applet


connect

public void connect()
Attempts to connect to the server. See connected for success or failure.

Throws:
java.lang.IllegalStateException - if already connected

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handle mouse clicks and keyboard

Specified by:
actionPerformed in interface java.awt.event.ActionListener

run

public void run()
continuously read from the net in a separate thread

Specified by:
run in interface java.lang.Runnable

put

public boolean put(java.lang.String s)
write a message to the net

Parameters:
s - the message
Returns:
true if the message was sent, false if not

treat

public void treat(SOCMessage mes)
Treat the incoming messages

Parameters:
mes - the message

handleCHANNELS

protected void handleCHANNELS(SOCChannels mes)
handle the "list of channels" message

Parameters:
mes - the message

handleREJECTCONNECTION

protected void handleREJECTCONNECTION(SOCRejectConnection mes)
handle the "reject connection" message

Parameters:
mes - the message

handleSTATUSMESSAGE

protected void handleSTATUSMESSAGE(SOCStatusMessage mes)
handle the "status message" message

Parameters:
mes - the message

disconnect

protected void disconnect()
disconnect from the net


getAppletInfo

public java.lang.String getAppletInfo()
applet info


destroy

public void destroy()
destroy the applet


usage

public static void usage()
for stand-alones


main

public static void main(java.lang.String[] args)
for stand-alones


JSettlers v1.0.6 API
Built ${date}