Why I cannot add ArrayList directly to Jlist?

后端 未结 4 1500
野的像风
野的像风 2021-01-24 09:07

i am trying to add ArrayList to Jlist, but the only way that I given to understand is that to write the code like this :

ArrayList labels = new Arr         


        
4条回答
  •  广开言路
    2021-01-24 10:09

    It's simple. JList constructors don't expect ArrayList

    JList()
    Constructs a JList with an empty, read-only, model.
    JList(E[] listData)
    Constructs a JList that displays the elements in the specified array.
    JList(ListModel dataModel)
    Constructs a JList that displays elements from the specified, non-null, model.
    JList(Vector listData)
    Constructs a JList that displays the elements in the specified Vector.
    

提交回复
热议问题