I have chartPanel
(JFreeChart), buttonPanel
and errorPanel
.
frame.add(chartPanel, BorderLayout.PAGE_START);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
errorPanel = new JLabel("Error String");
errorPanel.setHorizontalAlignment(JLabel.CENTER);
frame.getContentPane().add(buttonPanel, BorderLayout.CENTER);
frame.getContentPane().add(errorPanel, BorderLayout.SOUTH);
When I change height of application window, buttonPanel and errorPanel disappeared.
When I don't use JLabel:
frame.add(chartPanel);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
it's okey in changing of height of application window. How to make it right and not have problems with window zoom?
When you add to the JFrame the default location is CENTER but since you add to the chart to the PAGE_START now its not scalable...
solution:
take it out and just say
frame.add(chartPanel);
and for the errorPanel and ButtonPanel
just make a new JPanel with BorderLayout and add it to the SOUTH of your Frame Layout. Then inside that JPanel add your ButtonPanel and ErroPanel just like what you did in your Jframe..