import javafx.application.Application; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import javafx.collections.FXCollections; public class App extends Application { private final TableView table = new TableView<>(); public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { TableColumn nameCol = new TableColumn<>("Név"); nameCol.setMinWidth(100); nameCol.setCellValueFactory(new PropertyValueFactory<>("name")); TableColumn cityCol = new TableColumn<>("Település"); cityCol.setMinWidth(100); cityCol.setCellValueFactory(new PropertyValueFactory<>("city")); TableColumn salaryCol = new TableColumn<>("Fizetés"); salaryCol.setMinWidth(100); salaryCol.setCellValueFactory(new PropertyValueFactory<>("salary")); table.setItems(getEmployees()); table.getColumns().add(nameCol); table.getColumns().add(cityCol); table.getColumns().add(salaryCol); Scene scene = new Scene(table, 302, 250); primaryStage.setScene(scene); primaryStage.show(); } private ObservableList getEmployees() { ObservableList employees = FXCollections.observableArrayList( new Employee("Poros Béla", "Szeged", 2870000), new Employee("Tér Irén", "Szeged", 2435000), new Employee("Pakos Péter", "Hatvan", 2530000), new Employee("Szu Emese", "Szolnok", 2270000)); return employees; } }