@Override
		public void actionPerformed(ActionEvent e) {
					String ac = e.getActionCommand(); //get the action command
					//---------Connect button event-------------
					if(ac.equals("connect")){
						try {
							portNum = Integer.parseInt((String)portCBox.getSelectedItem()); //store the user's portnumber
						} catch (NumberFormatException e2) {
							//if invalid selection, just set it to default.
							portNum = DEFAULT_PORT;
						}// end catch
						if(hostText.getText().equals("localhost")){ //if the host is local
							try {
								socket = new Socket(); //define the socket object
								isa = new InetSocketAddress("localhost",portNum); //set the ip socket to be the local host and desired port number
								socket.connect(isa,TIME_OUT); //connects the ip socket to the server with a time out vlaue of 1000ms
								out = new ObjectOutputStream(socket.getOutputStream()); // gets the socket output stream and sets it to out
								in = new ObjectInputStream(socket.getInputStream()); // gets the socket inpit stream and sets it to in
								
							} catch (IOException e2) {
								terminalTextArea.setText("CLIENT>ERROR: Connection refused: server is not available. Check port or restart server.\n");
								return;
							}// end catch
							setButtons(); // set the buttons
							terminalTextArea.setText("Connected to " + socket + "\n"); //Connected successfully.
							
						}else{
							//invalid host name
							terminalTextArea.setText("CLIENT>ERROR: Unknown Host.");
						}// end else
					}// end if
					//--------------------------------------------
					
					//---------Send button event-------------
					else if(ac.equals("send")){
						try {
							out.writeObject(serverRequestText.getText()); //write to the outputstream the text inside of the server request textfield
						    input = ((String)in.readObject());//grab the text inside of serverrequest textfield and store inside input
						  //if an END command was issued
							if(input.equals(endInput)){ 
								resetButtons();
								terminalTextArea.append(input); //display the input text
								terminalTextArea.append("\nServer Socket: Connection closed.\n");
								return;
							}//end if
							else if(input.equals("cls")){ //if the user wants to clear the screen
								terminalTextArea.setText(""); //purge the area
								return;
							}// end else if
							terminalTextArea.append(input + "\n"); // finally, append the text in the input stream
						} catch (IOException | ClassNotFoundException e1) {
							terminalTextArea.append("SERVER>ERROR: Something has gone wrong\n");
						}// end catch
					}// end else if
				}// end method