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();
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();