ArrayList <String> cdcollection = new ArrayList();
private void initButtonActionPerformed(java.awt.event.ActionEvent evt) {
Collections.addAll(cdcollection, "small", "mayre", "brown", "evner", "rain" );
initButton.setEnabled(false);
}
private void displayButtonActionPerformed(java.awt.event.ActionEvent evt) {
for (int i = 0; i < cdcollection.size(); i++) {
mainTextArea.setText(cdcollection.get(i));
}
}
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {
cdcollection.add(cdtitleInput.getText());
}
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {
cdcollection.remove(cdcollection.size()-1);
}
当我运行它并单击显示按钮时,只出现最后一个 cd 标题(雨)......我怎样才能让所有五个 cd 标题都出现在一行上?