Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何计算列表框中的项目总数并显示在文本框中?
我想动态添加列表中的项目数,并显示在括号中的标题前面以及它的图像前面,就像显示待处理请求的通知一样
尝试
myJList.getModel().getSize();
获取列表框中的项目。并将其设置为文本框的文本。
替换myJList为您的列表。
myJList