如何在Javafx中将JSON表示为树视图

时间:2018-12-07 09:29:51

标签: json javafx

我有一个如下的Film模型:

public class Film{
    private String name;
    private String category;
    private Actor[] actors;
    private MarketingPlan marketingPlan; 
}

class Actor{
    private String name;
    private double salary;
}

class MarketingPlan{
    private String nameOfPlan;
    private Country[] affectedCountries;
}

class Country{
    private int countryID;
    private String marketingText;
}

生成这样的JSON:

{
  "name": "My First Film",
  "category": "action",
  "marketingPlan": {
    "name": "plan1",
    "affectedCountries": [
      {
        "marketingText": "This is a marketing text",
        "countryID": 332
      }
    ]
  },
  "actors": [
    {
      "name": "John",
      "salary": 123456
    }
  ]
}

我想将上面的JSON结果表示为JavaFX中的树结构。任何人都可以给我一些提示或建议我一些教程,我该怎么做。非常感谢您!

0 个答案:

没有答案