【发布时间】:2012-09-03 01:19:39
【问题描述】:
我需要实现一个 JList 来显示 Array-List 的内容。 ArrayList 包含“自定义”对象,我只想从中显示标题。
“自定义对象”可以有 - 标题 - 用户 等等
与我现在所做的(遍历整个数组并使用 title[i] = customObject.getTitle())构建另一个字符串数组相比,最有效的方法是什么?
感谢愿意花时间回答的人...
【问题讨论】:
-
阅读Javadoc of the JList class。它解释了一切:模型和渲染。无需创建包含所有“标题”的额外数组。
标签: java swing user-interface jlist custom-component