I am developing application in javaFX .I want to show json response in the tableview. I am not gettting how to do it
My files are as follows:
projects.fxml
<TableView fx:id="mytableTableView" layoutX="384.0" layoutY="54.0" prefHeight="210.0" prefWidth="202.0" tableMenuButtonVisible="true">
<columns>
<TableColumn prefWidth="75.0" text="ID" fx:id="idColumn" />
<TableColumn prefWidth="75.0" text="Name" fx:id="nameColumn" />
<TableColumn prefWidth="75.0" text="Identifier" fx:id="identifierColumn" />
<TableColumn prefWidth="75.0" text="Description" fx:id="descriptionColumn" />
<TableColumn prefWidth="75.0" text="CreatedOn" fx:id="created_onColumn" />
</columns>
</TableView>
project controller
@FXML
TableView<ProjectProperties> mytableTableView;
@FXML TableColumn<ProjectProperties,Integer> idColumn;
@FXML TableColumn<ProjectProperties,String> nameColumn;
@FXML TableColumn<ProjectProperties,String> identifierColumn;
@FXML TableColumn<ProjectProperties,String> descriptionColumn;
@FXML TableColumn<ProjectProperties,String> created_onColumn;
public void initialize(URL url, ResourceBundle rb)
{
String responseJSON = HttpManager.getData(url, null);
}
I get json response in responseJSON that I want to show in the table view.
I am not getting how to bind the json to the table view .
It is possible for me to convert json to the array.
But the setItems() method of tableview require the ObservableList .
So any suggesstions and example will be greately appriciated.