答案 0 :(得分:0)
我通过创建Label
对其进行排序,将其置于TextArea
后面,使其不可见(以防万一)并将TextArea高度绑定到标签:
@FXML
private TextArea msg;
@FXML
private Label bindingText;
@FXML
private Button button;
@FXML
private void initialize() {
bindingText.textProperty().bind(msg.textProperty());
msg.setText(Word.customTranslate("data_transfer_failed", Locale.getDefault().getLanguage()));
msg.prefHeightProperty().bind(bindingText.heightProperty());
button.setText(Word.customTranslate("close_app", Locale.getDefault().getLanguage()));
}