fixed Issue #28 by checking if username contains space before starting connection
This commit is contained in:
parent
b47d98b960
commit
b6fd5b569d
|
@ -106,6 +106,7 @@ public class ChatWindowController {
|
||||||
|
|
||||||
private void startConnectionHandler() throws IOException {
|
private void startConnectionHandler() throws IOException {
|
||||||
String userName = userNameField.getText();
|
String userName = userNameField.getText();
|
||||||
|
if(!userName.contains(" ")) {
|
||||||
String serverAddress = serverAddressField.getText();
|
String serverAddress = serverAddressField.getText();
|
||||||
int serverPort = Integer.parseInt(serverPortField.getText());
|
int serverPort = Integer.parseInt(serverPortField.getText());
|
||||||
connectionHandler = new ClientConnectionHandler(
|
connectionHandler = new ClientConnectionHandler(
|
||||||
|
@ -118,6 +119,9 @@ public class ChatWindowController {
|
||||||
|
|
||||||
// register window close handler
|
// register window close handler
|
||||||
rootPane.getScene().getWindow().addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, windowCloseHandler);
|
rootPane.getScene().getWindow().addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, windowCloseHandler);
|
||||||
|
} else {
|
||||||
|
addError("It is not allowed to have spaces in username!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void terminateConnectionHandler() {
|
private void terminateConnectionHandler() {
|
||||||
|
|
Loading…
Reference in New Issue