how to bind ArrayList to JList

后端 未结 5 754
花落未央
花落未央 2020-12-10 18:44

i have a JList and an ArrayList.How to bind the datas in arraylist to the jlist.Are the any alternative methods?

    ArrayList arl = new ArrayList();
    ar         


        
5条回答
  •  孤城傲影
    2020-12-10 19:02

    You don't need to clone the ArrayList. Just call toArray()

    JList list = new JList(arl.toArray()); 
    

提交回复
热议问题