akzeptiert Das ist meine Klasse für Tabellenansicht (nicht FX-Klasse seiner meine eigenen für Daten)JavaFX Tabelle keine Daten
class tableView {
SimpleIntegerProperty profit;
SimpleDoubleProperty probabilty;
public tableView(int profit, double prob) {
this.profit = new SimpleIntegerProperty(profit);
this.probabilty = new SimpleDoubleProperty(prob);
}
}
und Mein Code für Event-Handler und andere Controller ist:
Random r = new Random();
int noOfStream = Integer.parseInt(steamsize.getText());
double sellingPrice = Double.valueOf(sell.getText());
double costPrice = Double.valueOf(cost.getText());
int quantity = Integer.valueOf(Quantity.getText());
double discountPrice = Double.valueOf(discount.getText());
int randomStart = Integer.parseInt(RandStart.getText());
int randomEnd = Integer.parseInt(RandEnd.getText());
for (int i = 0; i < noOfStream; i++) {
int dem = r.nextInt(randomEnd - randomStart) + randomStart;
int profit = profitCacl(sellingPrice, costPrice, quantity, discountPrice, dem);
double prob = cal.probCal(profitArray, profit);
// System.out.println(profit);
// System.out.println(prob);
if (prob == 0.1) {
profitArray.add(new tableView(profit, prob));
}
}
}
@Override
public void initialize(URL url, ResourceBundle rb) {
cal = new methodsForCal();
choice.setItems(FXCollections.observableArrayList(
"Normal",
"Poison",
"Uniform"
));
Profit.setCellValueFactory(new PropertyValueFactory("profit"));
Probabilty.setCellValueFactory(new PropertyValueFactory("probabilty"));
profitArray = FXCollections.observableArrayList();
tableForReading.setItems(profitArray);
}
Jetzt ist mein Problem, dass meine Daten nicht in die Daten eingefügt werden! wie es auf der Konsole so gut wie ich will drucken!
Oder benutzen Sie einfach nicht 'PropertyValueFactory', natürlich ... –
lembda Ausdruck Fehler ist gegeben, wenn ich Ihren Weg @fabian verwenden –
Lambda-Ausdruck nicht hier erwartet –