Heavyweight Component resizing inside JScrollpane
in my application i have a heavyweight component (jpanel with a few buttons, jtextfields, jtextareas, etc) that i put in a scrollpane.
the scrollpane is supposed to only scroll vertically - in the horizontal direction, i want to resize the components in the scrollpane to the appropriate size depending on the main frame of the application.
when the application starts, everything is fine and the components take up the available size.
when i increase the application window size hotizonally, the components (mainly the jTF and jTA) increase in size, as it is's supposed to be.
But once i decrease the horizontal size again, the jTF and jTA stay the size they were before and do not shrink as i want them to.
If i just add the jpanel without putting it inside a jscrollpane, the resizing works perfect. i need a vertical scroller though, so this is not an option.
here is a picture that shows the resizing behaviour:
inside the JPanel that is inside the scrollpane i use a grouplayout.
here is a portion of my code that shows how one of the components inside the panel is layed out.
If other code portions are needed, please tell me.
// component layout for the LINKS panel
// horizontal groups
SequentialGroup hGroup = layout.createSequentialGroup();
ParallelGroup h2 = layout.createParallelGroup();
ParallelGroup h3 = layout.createParallelGroup();
ParallelGroup h4 = layout.createParallelGroup();
h2.addComponent(linkListScrollPane, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE);
// vertical groups
SequentialGroup vGroup = layout.createSequentialGroup();
ParallelGroup v1 = layout.createParallelGroup();
v1.addComponent(linkListScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
I hope someone can help me with this one :)