How u setup JScrollPane so it's dimension is not changed when add component

I have to add JCheckBoxes to JScrollPane. To add JCheckBoxes to JScrollPane, I have

a JPanel. I am adding JCheckBoxes to JPanel and JPanel is added to JScrollPane.

Problem is when I add less than 4 JChecksBoxes to JPanel, JScrollPane gets bigger than

its defined size. Does someone know what could be wrong?

Thanks

Amit

[364 byte] By [amit10] at [2007-9-26 1:34:35]
# 1
hi, this might happen if u have set some maximum size for JPanel , u can try with some seting maximum size for scrollpane itself.anand1
Anand1 at 2007-6-29 2:17:55 > top of Java-index,Archived Forums,Swing...
# 2
Make sure you are not actually adding the JPanel to the JScrollPane; what you want is to call scrollpane.setViewportView(panel);
earljavadev at 2007-6-29 2:17:55 > top of Java-index,Archived Forums,Swing...