-1
누군가 JavaFX에서 TableColumn을 동적으로 TableView에 추가하는 방법을 제안 할 수 있습니까?TableFolumn을 JavaFX의 TableView에 동적으로 추가하는 방법은 무엇입니까?
Row 클래스를 tableView에 표시해야하지만 다른 작업을 수행 한 후 노드 수를 알고 있습니다. Node에서 StringProperty를 사용하여 CellValueFactory를 설정하려고 할 때 문제가 발생했습니다. Node 클래스에서 예약 및 신뢰성 만 표시해야합니다.
public class Row {
private int step;
private Node[] nodes;
private double p = 1;
private double c;
private StringProperty stepProperty;
private StringProperty pProperty;
private StringProperty cProperty;
Row(int step, Node[] nodes, double c){
this.step = step;
this.nodes = nodes;
for (Node node:
nodes) {
p *= node.getReliability();
}
this.c = c;
}
public int getStep() {return step;}
public Node getNode(int index) {return nodes[index];}
public double getP() {return p;}
public double getC() {return c;}
public StringProperty stepProperty() {
this.stepProperty = new SimpleStringProperty(step + "");
return stepProperty;
}
public StringProperty pProperty() {
this.pProperty = new SimpleStringProperty(p + "");
return pProperty;
}
public StringProperty cProperty() {
this.cProperty = new SimpleStringProperty(c + "");
return cProperty;
} }
public class Node {
private StringProperty reserved;
private StringProperty reliability;
private StringProperty price;
Node(String reserved, String reliability, String price){
this.reserved = new SimpleStringProperty(reserved);
this.reliability = new SimpleStringProperty(reliability);
this.price = new SimpleStringProperty(price);
}
public StringProperty reliabilityProperty() {
return reliability;
}
public StringProperty priceProperty() {
return price;
}
public StringProperty reservedProperty() {
return reserved;
}
public double getReliability(){
return Double.parseDouble(reliability.get());}
public int getPrice(){return Integer.parseInt(price.get());}
public int getReserved(){return Integer.parseInt(reserved.get());}
}
당신이 같은 테이블보고 원하는 것을 설명 할 수 있습니까? 그것은 분명하지 않습니다. –
예를 들어, 내가 2 노드를 가지고 있다면 tableView에 표시해야합니다. Row.Step | 노드 [0] .reserved | 노드 [0]. 신뢰성 | 노드 [1] .reserved | 노드 [2]. 신뢰성 | Row.p | Row.c –
좋습니다. 도움이됩니다. 모든'Row' 객체는 포함하고있는 배열에 같은 수의 노드를 가지고 있습니까? 서로 다른'Row' 객체의 노드 수가 다른 경우 어떻게됩니까? 테이블이 표시되는 동안 새로운'Row' 객체를 추가합니까? 'Row' 객체의 노드 수는 언제 알 수 있습니까? –