Java&JFreeChart - How to set a JFreeChart's ChartPanel resize with it's container ( say JPanel )?
I just found that when i add a ChartPanel to a JFrame, the ChartPanel will resize to fit the frame as the JFrame dragged larger or smaller. However, when i add the ChartPanel to a JPanel, the JPanel's size( width and height ) changes to fit the JFrame as the JFrame resized. But the ChartPanel just keeps it's dimensions, leaving the enlarged JPanel a lot of empty space. How to make ChartPanel resize with it's container in GUI? Here is my sample codes : This case the chart resize with the JFrame ChartPanel chartPanel = new ChartPanel(createWhateverChart()); JFrame frame = new JFrame(); frame.add