you don't tell enough for me to know why you have to do this, but here is an idea. make an ArrayList of JFrames. have an int variable that gets incremented each time you open a new frame. store the frames in the ArrayList. i'm more used to using arrays. if it was an array it would look something like this:
myFrames[count] = new JFrame();
i guess with ArrayList you don't need a int variable. maybe just:
myFrames.add(new JFrame);
or something. i have a lot of studying to do to relearn all this.
anyway, just a thought.