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.
如何将项目从一个列表/数组列表移动到另一个列表/数组列表?
这是我需要做的
ArrayList
我终于想出了如何将项目添加到数组列表并将它们显示在列表框中。现在我需要知道如何选择它们并使用按钮将它们移动到另一个列表/数组。
有任何想法吗?
ListModel按照 MadProgrammer 的建议, 您将更容易使用
ListModel
你可以这样尝试
model = new DefaultListModel<String>(); for(String str : playlist){ model.addElement(str); } listPlaylist.setModel(model); listPlaylist.setSelectedIndex(0);
您可以为库和播放列表创建两个模型并执行操作