fixed Method Initializing. Setting Datafields serverAddress and serverPort.
#24
This commit is contained in:
parent
a75d3466ef
commit
bc86c47871
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue