![](https://csdnimg.cn/release/download_crawler_static/37014377/bg8.jpg)
ArrayList categoryArrayList = myDataClient.getCategories();
Iterator iterator = categoryArrayList.iterator();
String aCategory;
while (iterator.hasNext()) {
aCategory = (String) iterator.next();
categoryComboBox.addItem(aCategory);
}
topPanel = new JPanel();
musicListBox = new JList();
musicListBox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
musicScrollPane = new JScrollPane(musicListBox);
detailsButton = new JButton(" 详细 ...");
clearButton = new JButton(" 清空 ");
exitButton = new JButton(" 退出 ");
bottomPanel = new JPanel();
this.setLayout(new BorderLayout());
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
topPanel.add(selectionLabel);
topPanel.add(categoryComboBox);
this.add(BorderLayout.NORTH, topPanel);
this.add(BorderLayout.CENTER, musicScrollPane);
bottomPanel.setLayout(new FlowLayout());
bottomPanel.add(detailsButton);
bottomPanel.add(clearButton);
bottomPanel.add(exitButton);
this.add(BorderLayout.SOUTH, bottomPanel);
detailsButton.addActionListener(new DetailsActionListener());
clearButton.addActionListener(new ClearActionListener());