Rob Camick wrote:Post a SSCCE that demonstrates the problem.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Prime wrote:The JFrame uses a BorderLayout. The JFrame has one child component, a JPanel, at its center. That JPanel is stretched.
The JPanel uses a FlowLayout, with center alignment. This means that it will show all child components next to each other, with their preferred size.
If you get rid of that intermediate JPanel, the JScrollPane will be stretched over the entire JFrame.
Paul McDowell wrote:
Rob Prime wrote:The JFrame uses a BorderLayout. The JFrame has one child component, a JPanel, at its center. That JPanel is stretched.
The JPanel uses a FlowLayout, with center alignment. This means that it will show all child components next to each other, with their preferred size.
If you get rid of that intermediate JPanel, the JScrollPane will be stretched over the entire JFrame.
hmm, I see this seems to be an issue with my layout manager then. The actual program utilizes GridBagLayout for everything (JFrame and JPanel) which I left out of the SSCCE for simplicity (I didn't think about the layout manager being the issue). I have the same problem if I apply GridBagLayout to both containers as well.
The purpose of the JPanel is to allow me to add items below the JTree, like a banner for daily announcements or other things like that as well as to swap between screens easily (swapping between logged in and logged out states). Do you have any idea why GridBagConstraints is still centering the JScrollPane despite specifying the coordinates as 0,0?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions