JList that contains the list of Files in a directory

前端 未结 5 1981
庸人自扰
庸人自扰 2020-12-03 16:42

I created a JList that contains a list of files that are in a directory. Here is the JList.

JList MList;
String ListData[]
// Creat         


        
5条回答
  •  没有蜡笔的小新
    2020-12-03 17:06

    Create list of strings List fnames = new ArrayList();, fill it with file names (fnames.add(files);), then set it to JList using list.setListData(fnames.toArray());. I guess that should work.

提交回复
热议问题