SuperVCD管理系统 完整代码,带各种注释,可以拿这个项目入门。
exitButton.addActionListener(new ExitActionListener());
categoryComboBox.addItemListener(new GoItemListener());
musicListBox.addListSelectionListener(new MusicListSelectionListener());
detailsButton.setEnabled(false);
clearButton.setEnabled(false);
}
catch (IOException exc) {
JOptionPane.showMessageDialog(this, "网络问题 " + exc, "网络问题", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
protected void populateListBox() {
try {
String category = (String) categoryComboBox.getSelectedItem();
if (! category.startsWith("---")) {
musicArrayList = myDataClient.getRecordings(category);
}
else {
musicArrayList = new ArrayList();
}
Object[] theData = musicArrayList.toArray();
musicListBox.setListData(theData);
if (musicArrayList.size() > 0) {
clearButton.setEnabled(true);
}
else {
clearButton.setEnabled(false);
}
}
catch (IOException exc) {
JOptionPane.showMessageDialog(this, "网络问题: " + exc, "网络问题", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}