日期:2014-05-20  浏览次数:20959 次

怎么没有办法改变list的大小?
listPanel = new JPanel();
listPanel.setLayout(new FlowLayout());
listPanel.setBounds(new Rectangle(4,150,289,148));
listPanel.setBorder(BorderFactory.createEtchedBorder());
leftList = new List();
leftList.setBounds(new Rectangle(4,150,100,148));
//leftList.setLocation(4, 150);
//leftList.setSize(new Dimension(100,148));
listPanel.add(new JScrollPane(leftList));
playList = new List();
playList.setBounds(new Rectangle(100, 150, 189, 148));
playList.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
if(e.getClickCount() == 2){
playState();
}
}
});
listPanel.add(new JScrollPane(playList));
cp.add(listPanel);

------解决方案--------------------
噢 你JScrollPane js = new JScrollPane ();
js.add(你要显示的JList)
js.setBounds(new Rectangle(100, 150, 189, 148));
listPanel.add(js);
你看这样行不行 是不是你想要的