Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FXML
- TableView<Statistics> tableView;
- @FXML
- TableColumn<Statistics, Integer> colWeekNumber;
- @FXML
- TableColumn<Statistics, Double> colExerciseHours;
- public class HandleStatistics {
- public void addStatistics(TableView<Statistics> tableView, TableColumn<Statistics, Integer> colWeekNumber, TableColumn<Statistics, Double> colExerciseHours) {
- colWeekNumber.setCellValueFactory(new PropertyValueFactory<Statistics, Integer>("weekNumber"));
- colExerciseHours.setCellValueFactory(new PropertyValueFactory<Statistics, Double>("exerciseHours"));
- tableView.setItems(getStatistics());
- }
- public ObservableList<Statistics> getStatistics() {
- ObservableList<Statistics> statistics = FXCollections.observableArrayList();
- statistics.add(new Statistics(46, 4.6));
- statistics.add(new Statistics(47, 5.8));
- return statistics;
- }
- package Functionality;
- public class Statistics {
- private int weekNumber;
- private double exerciseHours;
- public Statistics(int weekNumber, double exerciseHours) {
- this.weekNumber = weekNumber;
- this.exerciseHours = exerciseHours;
- }
- public void setWeekNumber(int weekNumber) {
- this.weekNumber = weekNumber;
- }
- public int getWeekNumber() {
- return weekNumber;
- }
- public void setExerciseHours(double exerciseHours) {
- this.exerciseHours = exerciseHours;
- }
- public double getExerciseHours() {
- return exerciseHours;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement