panel添加许多控件,为什么不下拉条不能正常的滚动
public scrollpanel() {setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 376, 458);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setEnabled(false);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setBounds(5, 5, 300, 400);
scrollPane.setSize(300, 400);
contentPane.add(scrollPane);
JPanel panel = new JPanel();
panel.setBounds(1,1,200,200);
scrollPane.setViewportView(panel);
panel.setLayout(null);
for(int i =0 ;i<150;i++){
JButton j = new JButton();
j.setBounds( 0,i*100,100, 100);
panel.add(j);
}
}