repain();
不行就是你的布局问题了,请使用一个自动伸缩的布局.

解决方案 »

  1.   

    DefaultListModel model = new DefaultListModel();
     JList list = new JList(model);
     JScrollPane scrollpane = new JScrollPane(list);
     scrollpane.setAutoscrolls(true);
    改成:
    DefaultListModel model = new DefaultListModel();
     JList list = new JList(model);
     JScrollPane scrollpane = new JScrollPane();
     scrollpane.Add(list)
     scrollpane.setAutoscrolls(true);
    this.repaint();