TableColumn<CustomObject, Boolean> tableColumnTwo
확인란을 선택한 경우에만 CustomObject
의 필드 값을 기준으로 TableColumn<CustomObject, String> tableColumn
을 사용하지 않으려합니다. 나는 아래 관련 코드는, 사람이 보통이JavaFX 체크 박스 상태를 기반으로 TableColumn을 사용하지 않음
@FXML
private TableColumn<CustomObject, Boolean> tableColumnTwo;
@FXML
private TableColumn<CustomObject, String> tableColumn;
tableColumn.setCellFactory(
new Callback<TableColumn<CustomObject, String>, TableCell<CustomObject, String>>() {
@Override
public TableCell<CustomObject, String> call(TableColumn<CustomObject, String> paramTableColumn) {
return new TextFieldTableCell<CustomObject, String>(new DefaultStringConverter()) {
@Override
public void updateItem(String s, boolean empty) {
super.updateItem(s, empty);
TableRow<CustomObject> currentRow = getTableRow();
if(currentRow.getItem() != null && !empty) {
if (currentRow.getItem().getPetrified() == false) { // Need to check if checkbox is checked or not
setDisable(true);
setEditable(false);
this.setStyle("-fx-background-color: red");
} else {
setDisable(false);
setEditable(true);
setStyle("");
}
}
}
};
}
});
https://stackoverflow.com/help/how-to-ask 또는 다른 말로 : 당신이 무엇을하고 어떻게 목표를 달성하지 못했는지 보여주는 실행 가능한 예제를 제공하십시오. – kleopatra