Computer Science Canada

help with JFrame

Author:  SilverSprite [ Wed Jul 09, 2003 6:17 pm ]
Post subject:  help with JFrame

ok i've created an array of JFrames. everything compiles without errors but when i run the proogram and run the method and call an array slot.. the program crashes on me.. what do you think?
code:

first[i].show() // an example of what crashes first is the array of JFrames

Author:  rizzix [ Wed Jul 09, 2003 6:23 pm ]
Post subject: 

have u populated the array with JFrame objects first?

The array is just an array of refrences to JFrame. u'll first need to created a new JFrame object and assgin it to a reference like this:

code:


JFrame[] jarr = new JFrame[4];

for (int i = 0; i < 4; i++)
    jarr[i] = new JFrame();


Author:  SilverSprite [ Wed Jul 09, 2003 6:39 pm ]
Post subject: 

Yeah! Thanx alot.. that was the problem... man i didnt think you had to do them all.. oh wells thx again!


: