2013-02-24, 09:24 PM
SaptaZapta Wrote:You need to allocate memory for SkillLabels before you can access its cells.
my bad. I looked up more information on arrays, and I beleive I was able to allocate memory correctly, but im still getting the same error. did I do it wrong?
Code:
int skill = 1;
JLabel[][] SkillLabels;
SkillLabels = new JLabel[10][10];
while (skill < 4) {
SkillLabels[skill][1] = new JLabel(SkillDatabase.Skills[1].getName());
SkillLabels[skill][2] = new JLabel("Current Level:");
SkillLabels[skill][3] = new JLabel("Current Stats:");
SkillLabels[skill][4] = new JLabel(SkillDatabase.Skills[1].getDesc());
LevelSkill[skill] = new JButton("Level Skill");
LevelSkill[skill].addActionListener(this);
skill++;
}
