Hi, I'm writing a small Java GUI program, and I'm having some issues with Java not laying things out properly. I haven't done much Java GUI code lately, so I'm having trouble seeing where the problem lies.
final JFreeChart chart = createChart(dataset);
final ChartPanel chartPanel = new ChartPanel(chart, false);
chartPanel.setPreferredSize(new Dimension(500, 270));
JPanel buttonPanel = new JPanel();
buttonPanel.setPreferredSize(new Dimension(500,50));
JButton toggleButton = new JButton("Toggle");
final JTextField minRange = new JTextField("10");
final JTextField maxRange = new JTextField("1000");
JButton setLimits = new JButton("Set Limits");
buttonPanel.add(toggleButton, BorderLayout.NORTH);
buttonPanel.add(minRange, BorderLayout.SOUTH);
buttonPanel.add(maxRange, BorderLayout.SOUTH);
buttonPanel.add(setLimits);
JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, chartPanel, buttonPanel);
jsp.setDividerLocation(0.8);
setContentPane(jsp);
What's happening here is that all of the layout options are completely being ignored. The GUI components are showing up properly, and the divider specifically is ignoring the preferred size of JFreeChart, and squeezing it to about 5% of space at the top of the frame.