0
특정 값이 TableView
인 일부 셀만 색을 지정하는 방법이 있습니까?Javafx Tableview 특정 값의 셀을 색칠하는 방법
Callback<TableColumn, TableCell> historyTableCellFactory
= new Callback<TableColumn, TableCell>() {
public TableCell call(TableColumn p) {
TableCell newCell = new TableCell<CustomerHistoryStructure, String>() {
private Text newText;
@Override
public void updateItem(String items, boolean empty) {
super.updateItem(items, empty);
if (!isEmpty()) {
newText = new Text(items.toString());
newText.setWrappingWidth(140);
this.setStyle("-fx-background-color:#e50000 ;");
setGraphic(newText);
}
}
private String getString() {
return getItem() == null ? "" : getItem().toString();
}
};
return newCell;
}
};
위의 코드의 문제는 프로그램이 실행되고 난 TableView
에 스크롤 할 때, 다른 세포가 자신에 색깔받을 것입니다.
고맙습니다. 2 주 이상 해결하려고했습니다. – Peter