Class Client

java.lang.Object

   |

   +----java.awt.Component

           |

           +----java.awt.Container

                   |

                   +----java.awt.Panel

                           |

                           +----java.applet.Applet

                                   |

                                   +----client

public class client extends Applet

Constructors

client - public client()
This class encompasses all of the elements of the main thread of the client applet. It includes the main variables used in the applet, including the placeholders for the graphic and network portions of the code.
Methods
stringColor - public Color stringColor(String name)
stringColor is used to convert a color name from a text representation to an actual Java Color object. It accepts a string describing a color name and returns a Java Color object.
makebutton - public Button makebutton(String name, GridBagLayout gridbag, GridBagConstraints c)
Creates a button object that includes a place in the gridbag layout. This class, along with the following four classes assists in creating graphical objects using the gridbag layout. This class accepts the name of a button, a gridbag layout, and the gridbag constraints. It returns a button object.
maketextarea - public TextArea maketextarea(String name, int rows, int columns, GridBagLayout gridbag, GridBagConstraints c)
Creates a textarea object that includes a place in the gridbag layout. This class accepts the name of a textarea, the number of rows in the textarea, the number of columns in the textarea, a gridbag layout, and the gridbag constraints. It returns a textarea object.
maketextfield - public TextField maketextfield(String name, int columns, GridBagLayout gridbag, GridBagConstraints c)
Creates a textfield object that includes a place in the gridbag layout. This class accepts the name of a textfield, the number of columns in the textfield, a gridbag layout, and the gridbag constraints. It returns a textfield object.
makelist - public List makelist(int rows, GridBagLayout gridbag, GridBagConstraints c)
Creates a list object that includes a place in the gridbag layout. This class accepts the number of rows in the list, a gridbag layout, and the gridbag constraints. It returns a list object.
makelabel - public Label makelabel(String name, GridBagLayout gridbag, GridBagConstraints c)
Creates a label object that includes a place in the gridbag layout. This class accepts the name of a label, a gridbag layout, and the gridbag constraints. It returns a label object.
init - public void init() Overrides: init in class Applet
The main class of the applet. Init reads the parameters passed to the applet by the web page and uses these parameters coupled with the make classes to create the graphical user interface. Init sets up the gridbag layout and arranges the components in this layout. Init is the first class called when the applet starts. Init uses the make classes and stringColor.
start - public void start() Overrides: start in class Applet
Start is called every time the applet restarts. It is also called immediately following init when the applet is started. Start calls connect to initiate the network connection.
connect - boolean connect()
Connect opens the network connection to the server and initializes the client's socket. Connect handles the exceptions from creating a network connection. It also initializes the input and output data streams.
read_net_input - String read_net_input()
A simple function that returns one line of input from the network data stream.
write_net_output - void write_net_output(String string)
The complement to the above function, writes one line of text to the network, flushing the stream to assure the information is sent.
close_server - void close_server()
Closes the network connection to the server.
word_wrap - void word_wrap(String inputdata)
Word_wrap implements the word wrapping function for the main display area. It uses a temporary graphics object to measure the length of a string. It then breaks a text string down into pieces that can fit onto the message display area. The pieces are then appended to the text area.
handleEvent - public boolean handleEvent(Event e) Overrides: handleEvent in class Component
HandleEvent processes all actions made by the user that are relevant to the applet. These actions include list selections, data entry, and button clicks. These actions produce either a change in the display, and/or a network message to be sent. The messages are sent suing the Qchat protocol by means of the write_net_output class.
display - public void display()
Display is called by the writer class upon receipt of network traffic. The display class looks at the information received from the network (a single string) and decodes it from the Qchat protocol. The start of the string tells display what to do with the information. Example: REMOVEUSER&mendolf causes display to search the user list for mendolf and remove that name from the list.
stop - public void stop() Overrides: stop in class Applet
Stop is the called when the applet is removed from the system. The stop class calls close_server to destroy the network connection and then calls the writer's stop class to stop the writer thread.