在特定元素中的子元素数量发生变化后,如何运行方法?它的功能应该类似于下面的示例,该示例在特定元素的 text 属性更改后运行一个方法。package sample;import javafx.fxml.FXML;import javafx.scene.control.TextArea;public class Controller{ @FXML private TextArea textArea; @FXML private void initialize() { textArea.textProperty().addListener(e -> onTextPropertyChanged()); } private void onTextPropertyChanged() { System.out.println("cabbage"); }}
添加回答
举报
0/150
提交
取消