Package chatown

Examples of chatown.Client


          if (((Client) o).get_ID().equals(_clientID)) { myIndex = i;  } // save my location in array
          i++;
        }             
       
        // make myself appear at the top of the array
        Client clt = clientsArray[0];
        clientsArray[0] = clientsArray[myIndex];
        clientsArray[myIndex] = clt;
       
        // fire clients list event
        _eventNewClientsList.fireEvent(new NewClientsListEvent(this, clientsArray, _clientID));
View Full Code Here


      } catch (IOException e) {
        e.printStackTrace();
        return;
      }   
     
      Client newClient = new Client(_socket.getInetAddress().getHostName(), nickName, _clientID);   
     
      // fire CLIENT CONNECT event to update UI
      clientConnected(newClient);     
              
      // add new client to list
      _clientsMap.put(_clientID, newClient);
      CT_Socket ctSocket = new CT_Socket(_socket, _inputstream, _outputStream);
      _clientsSocketMap.put(_clientID, ctSocket);
     
      // send messages to other clients about new client
      sendClientsListToClients()
    }
    else if (clientObj instanceof OpenMsg) { // client sent open message
      OpenMsg om = (OpenMsg)clientObj;
     
      Client clt = _clientsMap.get(om.get_client().get_ID());
      clt.inc_numOpenMsgs();
      _clientsMap.put(clt.get_ID(), clt);
     
      OpenMsg newOM = new OpenMsg(clt, om.get_msg());     
     
      if (!_clientsMap.containsKey(newOM.get_client().get_ID())) { return; } // client not found in clients list
     
View Full Code Here

    loadIcon();
    addWindowListener(new WindowAdapter() {
      @Override
      public void windowClosing(WindowEvent e) {
        // send disconnect event to server
        Client clt = new Client(null, _nickname, _myClientID);
        _eventDisconnect.fireEvent(new DisconnectClientEvent(this, clt));
      }
    });
    init_look();
    getContentPane().setBackground(SystemColor.activeCaption);
View Full Code Here

      sendOpenMsgToServer(text)
    }
    else { //send message to client
     
      //check if receiver client connected
      Client msgReceiver = null;
      int i = 0;
      for (; i < clientsList.getModel().getSize(); i++) {
        Client clt = clientsList.getModel().getElementAt(i);
        if (clt.get_ID().equals(currRoom.get_clientID())) {
          msgReceiver = clt;
          break;
        }
          }
      if (!clientsListModel.contains(msgReceiver)) {
View Full Code Here

    }
    txtEnter.setText("");
  }
 
  private void sendOpenMsgToServer(String text) {
    Client clt = new Client(null, _nickname, _myClientID);
    _eventSendOpenMsg.fireEvent(new OpenMsgClientEvent(this, new OpenMsg(clt, text)));     
  }
View Full Code Here

    }       
    }

  public void handleClientMsg(String msg, String senderID) {
   
    Client msgSender = null;
    for (int i = 0; i < clientsList.getModel().getSize(); i++) {
      Client clt = clientsList.getModel().getElementAt(i);
      if (clt.get_ID().equals(senderID)) {
        msgSender = clt;
        break;
      }
        }
   
View Full Code Here

    lblServer.setIcon(new ImageIcon(scaledImage));
   
  }

  public void clientDisconnect(String clientID) {
    Client msgSender = null;
    int i = 0;
    for (; i < clientsList.getModel().getSize(); i++) {
      Client clt = clientsList.getModel().getElementAt(i);
      if (clt.get_ID().equals(clientID)) {
        msgSender = clt;
        break;
      }
        }
   
View Full Code Here

TOP

Related Classes of chatown.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.