How to resize this chart in jfreechart, netbeans?

前端 未结 2 1244
被撕碎了的回忆
被撕碎了的回忆 2021-01-25 08:00

I can\'t seem to manipulate the chart itself. I can\'t change the size and chartPanel = createChartPanel(); keeps rewriting into chartPanel = javax.swing.pan

相关标签:
2条回答
  • 2021-01-25 08:17

    Have you added your panel chartPanel to a JFrame?

    If not, try this:

    JFrame jf = new JFrame("Chart");
    jf.add(chartPanel);
    jf.pack();
    jf.setSize(frame_width,frame_height);
    jf.setVisible(true);
    

    As you can see from code, you can edit the size of the frame in which the chartPanel is contained, with jf.setSize(frame_width,frame_height);.

    You can just take a look to these API:

    JFrame API : http://download.oracle.com/javase/6/docs/api/javax/swing/JFrame.html

    JPanel API : http://download.oracle.com/javase/6/docs/api/javax/swing/JPanel.html

    0 讨论(0)
  • 2021-01-25 08:23

    You don't have to worry about your chart size, set your Panel's layout to GridBagLayout that should help.

    0 讨论(0)
提交回复
热议问题