开发者

SWT Combo/List only allows to add item value, but no key

Is there a way to store both key and value in an item in a SWT Combo/List? If not, are there SWT components that look like a Combo and/or开发者_运维知识库 List that do?


Yes, there is. Use the setData( String key, Object value ) method.


Take a look at JFace, especially the viewers. The ComboViewer should be the right tool for the job.

Basically, the viewers are there for mapping between your domain objects and SWT components. There is even data binding functionality available which saves you a lot of boiler-plate code.


JFace Structured Viewers are the answer. Learn more about them here. They have a special combo implementation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜