我正在尝试制作一个可ListView
编辑的. 在我的代码下方(已执行但编辑不起作用):onEditCommit
onEditCancel
ListView
public class ItensTipoStringController implements Initializable {
@FXML
private ListView lstItens;
ArrayList<String> itens = new ArrayList<>();
ObservableList itensObservaveis = FXCollections.observableArrayList(itens);
@Override
public void initialize(URL url, ResourceBundle rb) {
itens.add("Evandro");
itens.add("Miguel");
lstItens.setEditable(true);
lstItens.setCellFactory(TextFieldListCell.forListView());
lstItens.getItems().addAll(itens);
lstItens.setOnEditCommit(new EventHandler() {
@Override
public void handle(Event event) {
System.out.println("onEditCommit");
}
});
lstItens.setOnEditCancel(new EventHandler() {
@Override
public void handle(Event event) {
System.out.println("onEditCancel");
}
});
lstItens.setOnEditStart(new EventHandler() {
@Override
public void handle(Event event) {
System.out.println("onEditStart");
}
});
}
}