-3
如何在循環中創建這部分(JTable)代碼?如何在循環中加載這些變量的數據
Object[][] dataEntries =
{
{ firstName[0], "secondName[0]", ""Click to select"", new Boolean(false) },
{ firstName[1], "secondName[1]", ""Click to select"", new Boolean(false) },
{ firstName[2], "secondName[2]", ""Click to select"", new Boolean(false) },
{ firstName[3], "secondName[3]", ""Click to select"", new Boolean(false) }
};
Becouse我想這就像
Object[][] dataEntries =
{
{ firstName[i], "secondName[i]", ""Click to select"", new Boolean(false) },
{ firstName[i+1], "secondName[i+1]", ""Click to select"", new Boolean(false) },
{ firstName[i+2], "secondName[i+2]", ""Click to select"", new Boolean(false) },
{ firstName[i+3], "secondName[i+3]", ""Click to select"", new Boolean(false) }
};
你忘了創建第二個維數組。 –
@NarendraPathai謝謝你的回覆,但我沒有忘記:Object [] [] dataEntries = new Object [4] [4];' – Lrrr
謝謝,但我改變 dataEntries [i] [1] =「secondName [」+ 1 + 「]」; 至 secondName [i]; ,因爲它夠了。 – arkani