Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
部分的に埋められた配列で埋められた JList を使用するプロジェクトを作成しています。これにより、JList の要素が空になります。それをなくす最善の方法は何ですか。
部分的に埋められた配列が既にあり、それを変更できない場合は、Vectornull ではない配列のすべての要素を埋めて a を使用し、それを に割り当てますJList。
Vector
JList
それ以外の場合は、オブジェクトを ではなくコレクションに格納し、を作成するか、 で割り当てるときにarray、そのメソッドを呼び出します。toArrayJListJList#setListData
array
toArray
JList#setListData