Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What's the proper way to populate a ListView with a huge number of items?

ytwApr 10 2012 — edited Apr 10 2012
Hello,

I followed the "List of Color Patterns" example on this page (http://docs.oracle.com/javafx/2.0/ui_controls/list-view.htm#CEGGEDBF) and it worked well.
I modified the code and every time the ObservableList<String> is changed (i.e. add or remove an item), the "Observer" (ListView) is updated immediately.

For my application, I need to add a huge number of items to the ObservableList. For efficiency reasons and better UI responsiveness, I'm thinking I should use a different thread to populate the ObservableList and some how control how often the Observer updates itself.
My questions are:
#1. Is this the right approach? If not, what's the proper way to handle this situation?
#2. How to control the frequency that the Observer updates itself?

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 8 2012
Added on Apr 10 2012
3 comments
599 views