Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6fd5b569d | ||
|
|
b47d98b960 | ||
|
|
7c68472859 |
@@ -106,6 +106,7 @@ public class ChatWindowController {
|
||||
|
||||
private void startConnectionHandler() throws IOException {
|
||||
String userName = userNameField.getText();
|
||||
if(!userName.contains(" ")) {
|
||||
String serverAddress = serverAddressField.getText();
|
||||
int serverPort = Integer.parseInt(serverPortField.getText());
|
||||
connectionHandler = new ClientConnectionHandler(
|
||||
@@ -118,6 +119,9 @@ public class ChatWindowController {
|
||||
|
||||
// register window close handler
|
||||
rootPane.getScene().getWindow().addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, windowCloseHandler);
|
||||
} else {
|
||||
addError("It is not allowed to have spaces in username!");
|
||||
}
|
||||
}
|
||||
|
||||
private void terminateConnectionHandler() {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ClientConnectionHandler implements Runnable {
|
||||
public static final String USER_NONE = "";
|
||||
public static final String USER_ALL = "*";
|
||||
|
||||
private final Pattern messagePattern = Pattern.compile( "^(?:@(\\w*))?\\s*(.*)$" );
|
||||
private final Pattern messagePattern = Pattern.compile( "^(?:@(\\S*))?\\s*(.*)$" );
|
||||
|
||||
private SimpleStringProperty userName;
|
||||
private SimpleObjectProperty<State> state;
|
||||
@@ -63,7 +63,6 @@ public class ClientConnectionHandler implements Runnable {
|
||||
|
||||
public void setState (State newState) {
|
||||
state.set(newState);
|
||||
|
||||
}
|
||||
|
||||
public void run () {
|
||||
|
||||
Reference in New Issue
Block a user