1
我正在開發一個用於國際象棋的小型服務器 - 客戶端系統。用戶可以要求其他用戶進行遊戲,這是我的問題。客戶端向服務器發送消息,服務器將消息直接發送給另一個客戶端,另一個客戶端獲取消息。在收到消息後,客戶應該打開一個警報來選擇是否要與其他客戶端玩,但它不會打開。這是我的代碼JavaFX 8 - 警報未打開
} else if (readed.equals("+anfrage")){
String n=clientSocket.readLine();
Alert in=new Alert(AlertType.CONFIRMATION); //here the program stucks
in.setHeaderText("Spielanfrage von: "+n);
in.getButtonTypes().clear();
in.getButtonTypes().addAll(ButtonType.YES, ButtonType.NO);
in.setResizable(false);
Optional<ButtonType> opt=in.showAndWait();
if (opt.get()==ButtonType.YES) {
} else{
}