我如何创建一个包含String和Object的Hashtable条目的JList? [英] How can I create a JList that contains entries of a Hashtable of String and Object?
本文介绍了我如何创建一个包含String和Object的Hashtable条目的JList?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个JList,其中包含一个String和Object的Hashtable条目:
I want to create a JList that contains entries of a Hashtable of String and object :
Hashtable<String,Object>
JList元素应包含哈希表项并显示作为字符串的项键值。 ..
the JList element should contain the hashtable entry and display the value of the entry key that is a string ...
可能吗?如何做到这一点?
Is it possible ? How can it be done ?
推荐答案
通过扩展实现 ListModel
AbstractListModel上
。使用派生模型创建 JList
。另请参阅 如何使用列表 。
Implement the ListModel
interface by extending AbstractListModel
. Use the derived model to create your JList
. See also How to Use Lists.
这篇关于我如何创建一个包含String和Object的Hashtable条目的JList?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文