Java – is there a delayed loading implementation of JList?
•
Java
Is there any way to implement delayed loading with swing's JList?
Solution
In a way, yes You can create a custom listmodel. If it has not been loaded, use the getelementat (int index) method to load the correct value See the example in JavaDocs for JList:
// This list model has about 2^16 elements. Enjoy scrolling. ListModel bigData = new AbstractListModel() { public int getSize() { return Short.MAX_VALUE; } public Object getElementAt(int index) { return "Index " + index; } };
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码