I'm fairly new to programming and for school I have to create a program with a certain amount of classes. It's all going quite well for now, but I'm stuck on the graphic output of my data. The program is an expenses calculator. It is an frame devided in 6 JPanels. one of them should be a Piechart I created. The piechart works but won't show in my Frame. So I'm stuck on how to call in the right content to the panel. The code of the panel where I want to add the piechart is :
class CenterPaneel extends JPanel{
private static final long serialVersionUID = -835526987955952967L;
public CenterPaneel(){
setLayout( new GridLayout(2,3,10,10));
add( new Catagorie1Paneel() ); add( new Catagorie3Paneel() ); add( new SamenvattingPaneel() );
add( new Catagorie2Paneel() ); add( new Catagorie4Paneel() ); add( new DataPaneel());
}
And the code for the piechart is:
class DataPaneel extends JPanel{
private static final long serialVersionUID = -2980457707385367851L;
private final ObservableList<PieChart.Data> details = FXCollections.observableArrayList();
private BorderPane root;
private PieChart pieChart;
public void start(Stage primaryStage) {
primaryStage.setTitle("test");
details.addAll(new PieChart.Data("test1", 25),
new PieChart.Data("test 2", 25),
new PieChart.Data("test 3", 25),
new PieChart.Data("test 4", 25)
);
root = new BorderPane();
Scene scene = new Scene(root,600,500);
pieChart = new PieChart();
pieChart.setData(details);
pieChart.setTitle("test");
pieChart.setLegendSide(Side.BOTTOM);
pieChart.setLabelsVisible(true);
primaryStage.setScene(scene);
primaryStage.show();
}
}
The output of the code so far is :
If someone could help me I would be very happy:)
Thanks in advance