java第二个数组未在TextArea中打印
我有两个区域。第一个文本区域应该只显示最新的口袋妖怪。下面的文本区域应该显示所有口袋妖怪的列表
我正在第二个文本区域打印列表,它应该会列出我所有的列表。但当我点击“口袋妖怪列表”按钮时,什么也不会打印
st = new PokemonGUI(sSpe, sName, iNum, iHP);
if (count < capacity) {
stArr[count] = st;
lMsg.setText("pokemon added");
count++;
textArea.setText(st.toString());
} else {
lMsg.setText("array full, cannot add pokemon");
}
} catch (PokemonException e) {
lMsg.setText(e.getMessage());
}
//redisplay the list of pokemon
sOut = "";
for (int j = 0; j < capacity; j++) {
if (j < count) {
sOut += (j + 1) + " " + stArr[j].toString() + "\n\n";
}
}
if (event.getSource() == bList) {
textArea2.setText(sOut);
}
} catch (NumberFormatException nfe) {
lMsg.setText("Error! Invalid option");
}
共 (0) 个答案