开发者

Java Swing Updating JList

I'd like to know if there is any way that I can update a Jlist afte开发者_开发百科r the user adds or removes an item to it and after a user sorts it. Is there any way that I can write a standardized method to update the display based on the order of items in an array or vector, and when the user remove or adds an object from the array that the JList is based on?

Thank you.


Updates should be made to the ListModel, not the Array that was used to create the model.

However, if you want to refresh the list with completely new items or change the order of the items then you create a new DefaultListModel and use the setModel(...) method of the JList to update the view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜