Compare commits

...

1 Commits

Author SHA1 Message Date
schrom01 bc86c47871 fixed Method Initializing. Setting Datafields serverAddress and serverPort.
#24
2022-04-15 01:26:24 +02:00
1 changed files with 9 additions and 2 deletions

View File

@ -34,9 +34,16 @@ public class ClientConnectionHandler extends ConnectionHandler implements Runnab
}
public void initialize(String serverAddress, int serverPort, String userName) throws IOException {
state = new SimpleObjectProperty<>(NEW);
setConnection(NetworkHandler.openConnection(serverAddress, serverPort));
this.state = new SimpleObjectProperty<>(NEW);
this.serverAddress = new SimpleStringProperty(serverAddress);
this.serverPort = new SimpleIntegerProperty(serverPort);
this.userName = new SimpleStringProperty((userName == null || userName.isBlank())? USER_NONE : userName);
try {
setConnection(NetworkHandler.openConnection(this.serverAddress.get(), this.serverPort.get()));
} catch (IOException e) {
messages.addMessage(new Message(Message.MessageType.ERROR,null,null,e.getMessage()));
System.out.println("ERROR: " + e.getMessage());
}
}
public SimpleStringProperty getServerAddressProperty() { return serverAddress; }