0
개체 필드를 기반으로 특정 색의 원을 동적으로 그려주는 ListView를 만들었습니다. 셀에는 수출 된 세 가지 상태가있을 수 있으며 필수 정보가 있으며 둘 중 하나가 없습니다. 처음 두 개는 자신 만의 원색을 가지고 있는데 두 그래픽 모두를 구현하는 "어느 것도 가지고 싶지 않다"라고 말합니다. 두 개의 원. 문제는 셀에 대해 하나의 그래픽 만 설정할 수 있다는 것입니다.두 개의 원이있는 모양을 만드는 방법은 무엇입니까?
원의 centerX를 변경하고 두면 모두에서 Shape.union을 사용하여 해결 방법을 찾으려고 시도했지만 circEx 만 표시합니다. 이 방법을 구현할 수 있습니까?
는listView.setCellFactory(new Callback<ListView<BusinessCard>, ListCell<BusinessCard>>(){
@Override
public ListCell<BusinessCard> call(ListView<BusinessCard> list){
return new ColorCell();
}
});
//Colors circled that indicates status of card on listView
static class ColorCell extends ListCell<BusinessCard> {
@Override
public void updateItem(BusinessCard item, boolean empty) {
super.updateItem(item, empty);
//Probably should have one circle and setFil in if statements
Circle circMan = new Circle(0,0,3,Color.web("#ff9999"));
Circle circEx = new Circle(10,0,3,Color.web("#808080")); // old #e1eaea
Circle circDone = new Circle(0,0,3,Color.web("#99ff99")); //old #99ff99
if(item != null){
setTextFill(Color.BLACK);
setText(item.toString());
if(item.wasExported() && !item.hasMand()){
setGraphic(Shape.union(circMan, circEx)); //TODO
}
else if(item.wasExported()){
setGraphic(circEx);
}
else if(!item.hasMand()){
setGraphic(circMan);
}
else{
setGraphic(circDone);
}
}
}
}
는
반원형의 반원을 만들 수 있습니까? – trashgod
흠, 내가 두 개의 원을 만들 수 있고 두 개의 원 사이의 결합으로 모양을 만들 수 있는지 알 수 있습니다.하지만이 두 원을 사용해야한다고 생각합니다. – Javant