Collection - problem

Hi, I got a program in which after clicking the button the frame is added to the pulpit (frame extend after JInternalFrame);

I'm planning to do something that after clicking that button I will add objects (individual frames) and I want to keep them in collection so i could take out the right one to edit (it's going to be exactly that frame that I will select) Problem is that I don't know how to make it that after cliking the button I can automaticly adddifferent objects of each class (i'm think taht should be different objects but i don't know exactly)

small part of my code:

class MyInternalFrame extends JInternalFrame {

public MyInternalFrame(String title) {

...

}

public String getPlainText() {

...

}

public JTextArea resultText(String plainText) {

...

}

//fields

}

class Main() {

//i create example of collection (or class container - i don't know how should i called it)

ArrayList <JInternalFrame> frames = new ArrayList <JInternalFrame>();

public void AddNewFrame() {

//i want create here a new objects

}

}

PS. I apologise for my english

PS2. I don't mean the running of the button because I got this. I only don't have the way of adding the frame

and the question is: how can i create that different objects

Message was edited by:

thud_Mike

[1447 byte] By [thud_Mikea] at [2007-11-27 0:22:41]
# 1
frames.add(new MyInternalFrame("some title"));?
OleVVa at 2007-7-11 22:17:45 > top of Java-index,Core,Core APIs...
# 2
Yeah, i've already done it (i didn't know that different object could have the same names :)) and I didn't know how to delete topic :);but thanks for answer
thud_Mikea at 2007-7-11 22:17:45 > top of Java-index,Core,Core APIs...
# 3
Good. Let's just leave the topic around for the sake of anyone else who might encounter a similar problem.
OleVVa at 2007-7-11 22:17:45 > top of Java-index,Core,Core APIs...