摘要
JList控件可以显示一组相似的数据列表,但其显示的数据通常是无序的。本文详细描述了如何设计和实现有序Jlist控件,运用一个简单的应用程序示范了其设计思想。使用装饰器设计模式为已有的ListModel接口提供了更多的功能,这样可以只需对已有的应用程序进行少量的修改,就可以充分获得使用有序列表样式所带来的好处。
Java programmers often use the JList component to provide list views of similar data, Despite the convenience of this user interface component , a JList doesn" t sort its elements. This article describes how to produce sorted lists and uses a simple application to demonstrate concepts. The application uses the decorator design pattern to provide additional functionality to the ListModel object you already use. This allows you to use and benefit from a sorted model after making only minimal changes to your existing application code base.
出处
《微计算机信息》
北大核心
2007年第18期219-221,共3页
Control & Automation