Ich versuche, aus der TXT-Datei einfügen, aber ich konnte es nicht tun.Nehmen Sie eine TXT-Datei und Einfügen in die Tabellenansicht (JavaFX)
Das ist meine TXT-Datei.
aa.txt (Es enthält int A, B int, int F)
0 0 0
1 0 1
0 1 0
1 0 0
diese Produktklasse (Informationsteil)
public class Product {
private int A;
private int B;
private int F;
public Product(){
this.A = 0;
this.B = 0;
this.F = 0;
}
public Product(int A, int B, int F){
this.A = A;
this.B = B;
this.F = F;
}
public int getA() {
return A;
}
public void setA(int a) {
this.A = a;
}
public int getB() {
return B;
}
public void setB(int b) {
this.B = b;
}
public int getF() {
return F;
}
public void setF(int f) {
this.F = f;
} }
Dies ist in der Codeteiltabelle Ansicht ist, aber ich kann an diesem Teil nicht tragen
TableColumn<Product, Integer> aColumn = new TableColumn<>("A");
aColumn.setMinWidth(100);
aColumn.setCellValueFactory(new PropertyValueFactory<>("A"));
TableColumn<Product, Integer> bColumn = new TableColumn<>("B");
bColumn.setMinWidth(100);
bColumn.setCellValueFactory(new PropertyValueFactory<>("B"));
TableColumn<Product, Integer> fColumn = new TableColumn<>("F");
fColumn.setMinWidth(100);
fColumn.setCellValueFactory(new PropertyValueFactory<>("F"));
table = new TableView<>();
table.setItems(getProduct());
table.getColumns().addAll(aColumn, bColumn, fColumn);
Bitte helfen Sie mir zu diesem Thema ..
welchen Fehler Sie bekommen? Was macht getProduct()? – TruckDriver