public ChatClient(String hostName, String port) 
    {
        super();
        
        
        if (System.getProperty("os.name").contains("Mac")) {
		System.out.println("The game knows that it is running on Mac OS.");
			System.setProperty("apple.laf.useScreenMenuBar", "true"); //make JMenuBars appear at the top in Mac OS X
		}
		else if (System.getProperty("os.name").contains("Windows")){
		System.out.println("The game knows that it is running on Windows.");
		}
		else {
		 System.out.println("The game does not know what system it is running on. Unless you are running Linux or something obscure (in which case this is fine), this is a minor problem.");
		}
        
        // connect to server
        try {
            socket = new Socket(hostName, Integer.parseInt(port));
            out    = new Out(socket);
            in     = new In(socket); //IF SERVER SENDS A SINGLE MESSAGE W/ RIGHT CURLY BRACE, 
        }
        catch (Exception ex) { ex.printStackTrace(); }

        // close output stream  - this will cause listen() to stop and exit
        addWindowListener(
            new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    out.close();
                    
                    
                   // in.close();
                    //try                   { socket.close();        }
                    //catch (Exception ioe) { ioe.printStackTrace(); }
                }
            }
        );


        // create GUI stuff
        enteredText.setEditable(false);
        enteredText.setBackground(Color.BLACK);
        enteredText.setForeground(Color.GREEN);
        typedText.setForeground(Color.GREEN);
        typedText.setBackground(Color.BLACK);
        typedText.addActionListener(this);
        
        
        
        JOptionPane getName = new JOptionPane();
        String nicky = getName.showInputDialog("Please input your nickname.");//gets name
        System.out.println("Name: "+nicky);
        out.println(nicky);
        name = nicky;
      /*  
        if (!socket.isConnected())
        {
            JOptionPane getNameAgain = new JOptionPane();
            String nik = getNameAgain.showInputDialog("That is not a valid nickname.  Please input your nickname.");//gets name
            System.out.println("Name: "+nik);
            out.println(nik);
            name = nik;
        }
        */
        JOptionPane getPass = new JOptionPane();
        String pizzle = getPass.showInputDialog("Please input your password.");//gets name
        out.println(pizzle);
        pass= pizzle;
        
      /*  if (!socket.isConnected())
        {
            JOptionPane getPassAgain = new JOptionPane();
            String paa = getPassAgain.showInputDialog("That is not a valid password. Please input your password.");//gets name
            
            out.println(paa);
            pass = paa;
        } */
        
        Container content = getContentPane();
        content.add(new JScrollPane(enteredText), BorderLayout.CENTER);
        content.add(typedText, BorderLayout.SOUTH);
        content.validate();
        this.validate();
        
        JMenuBar menubar = new JMenuBar();
        JMenu menu = new JMenu("Connection");
        JMenuItem leave = new JMenuItem("Exit chat server");
        menu.add(leave);
        leave.addActionListener(this);
        menubar.add(menu);
        menubar.validate();
        menubar.setVisible(true);
        this.setJMenuBar(menubar);
        
        setVisible(true);
        
        // to encrypt, use /encrypt & encryption class
        //put button 
        //every time message is sent while encryption is on, put {slash in front of it
        // display the window, with focus on typing box
        setTitle("Chat Client 9000!!!!: [" + hostName + ":" + port + "]");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
        typedText.requestFocusInWindow();
       

        listen();
    }