public void connect() {

        if (username.length() == 0) {
            return;
        }

        if (portField.length() == 0) {
            return;
        }

        if (serverField.length() == 0) {
            return;
        }

        int port = 0;

        try {
            port = Integer.parseInt(portField);
        } catch (Exception e) {
            return;
        }

        client = new ClientEngine(serverField, port, username, this);
        if (!client.start())
            return;

        connected = true;
        sendText.setEditable(true);
        sendText.setText("");
        connectButton.setEnabled(false);
        discButton.setEnabled(true);
        fileLogin.setEnabled(false);
        connect.setEnabled(false);

    }