为什么在JPanel上加滚动条不成功啊,滚动条不能滚动
void add()
{
CookiePanel rightpanel=new CookiePanel();
JScrollPane scroll = new JScrollPane();
scroll.setBounds(200, 120, 770, 590);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setBackground(null);
scroll.setOpaque(false);
scroll.getViewport().setOpaque(false);
scroll.setBorder(null);
this.add(scroll);
scroll.add(rightpanel);
}
public class CookiePanel extends JPanel{
public CookiePanel()
{
this.setBounds(0,0,800,990);
//this.setBounds(200, 120, 800, 550);
this.setBackground(null);
this.setOpaque(false);
this.setPreferredSize(null);
//this.setLayout(new FlowLayout(FlowLayout.LEFT,30,20));
this.setLayout(null);
}
}