private void jButton1_actionPerformed(ActionEvent e) throws IOException {
        String username = new String(jTextField1.getText());
        String port = new String(jTextField2.getText());
        String server = new String(jTextField3.getText());

        // If username is empty
        if (username.equals("")) {
            jButton.setEnabled(false);
            JLabel errorFields = new JLabel(
                    "You must enter a username to login.");
            JOptionPane.showMessageDialog(null, errorFields);
            jButton.setEnabled(true);
            this.setVisible(true);
        } 
        // Port is empty
        else if (port.equals("")) {
            jButton.setEnabled(false);
            JLabel errorFields = new JLabel(
                    "You must enter a port to login. The default port is 4444.");
            JOptionPane.showMessageDialog(null, errorFields);
            jButton.setEnabled(true);
            this.setVisible(true);
        }
        // Server is empty
        else if (server.equals("")) {
            jButton.setEnabled(false);
            JLabel errorFields = new JLabel(
                    "You must enter a port to login. The default port is 4444.");
            JOptionPane.showMessageDialog(null, errorFields);
            jButton.setEnabled(true);
            this.setVisible(true);
        } 
        // Checks that the username is a-zA-z0-9
        else if (Pattern.matches("\\w", username)) {
            jButton.setEnabled(false);
            JLabel errorFields = new JLabel(
                    "I'm sorry usernames can only contain letters and numbers\n" +
                    "and must be at least 2 letters.");
            JOptionPane.showMessageDialog(null, errorFields);
            jButton.setEnabled(true);
            this.setVisible(true);
        } 
        // Otherwise try to set up a connection
        else {
            try {
                clientModel = new ClientModel(new Socket(server,
                        Integer.valueOf(port)));
                ClientConnectionHandlerThread.clientModel = clientModel;
                ClientConnectionHandlerThread.setLoginView(this);
                handlerThread.start();
                clientModel.requestUser(username);
            }
            // If there is an error retry, but now you have a clientModel so we 
            // use a different method.
            catch (IllegalArgumentException e1) {
                System.err.println("FileNotFoundException2: " + e1.getMessage());
                retryPortServer() ;
            }
            catch (IOException e1) {
                System.err.println("FileNotFoundException2: " + e1.getMessage());
                retryPortServer() ;
            } 
            catch (Exception e1) {
                System.err.println("Caught IOException: " + e1.getMessage());
                retryPortServer() ;
            }
        }

    }