這裏我使用rating feature of ControlsFX。每次更改評分值時,我都需要更新TextField中的值,如屏幕截圖所示。有沒有可能在這裏使用javafx.concurrent.Task?我該如何應用它? 將評分值設置爲文本框
這裏是我的代碼:
@FXML
private HBox ratinghbox;
@FXML
private TextField yourratingtxt;
private Rating rating;
@Override
public void initialize(URL url, ResourceBundle rb) {
rating = new Rating();
rating.setPartialRating(true);
ratinghbox.getChildren().add(rating);
yourratingtxt.setText(String.valueOf(rating.getRating()));
}