Populate tableview with two dimensional array

前端 未结 2 1542
谎友^
谎友^ 2021-01-18 07:43

Am new to Javafx and wondering how to populate a tableview from a 2-dimensional array of String:

    String[][] staffArray = (String[][]) connection.getAll(\         


        
2条回答
  •  情话喂你
    2021-01-18 08:24

    Best practices for TableView in JavaFX are to use Objects with Properties and bind them to Columns.

    I would suggest moving on or converting your 2 dimensional array to a more Strongly Typed model.

    What you are aiming for is to have a ObservableList that you can then assign to your TableView.

    Oracle has a really good introduction to the TableView that show cases the recommendations I suggested.

提交回复
热议问题