You don't need to tear down parts of the gui to fill your JList. Just set its model
Not
>>
fileList = new JList( files );
etc.
>>
but
addFiles(files, filesList);
private void addFiles(File[] files, JList fileList) {
DefaultListModel dlm = new DefaultListModel();
for (File f : files) {
dlm.addElement(f);
}
fileList.setModel(dlm);
}
Main Topics
Browse All Topics





by: asood314Posted on 2007-07-26 at 22:30:17ID: 19580385
instead of this
().setView (fileList) ;
fileScrollPane = new JScrollPane(fileList);
do this
fileScrollPane.getViewport
that should fix the problem.