• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to keep track of the frames that are opened from Applet

 
Jayakumar Gopalan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my applet, whenever the user clicks some buttons it will open a new frame with differet titles. Now, I want to know how to keep track of these frames i.e. how to check what are all the frames that my applet opened. I don't want to store these objects in a hastable or so. Please suggest me how to do it.
Thanks in advance.
Regards,
Jayakumar
--------------------------------------------
Let me explain my problem. In my applet I am having three list boxes. After selecting one item from each lists and click the button, I am opening a new frame ( class is "DetailsFrame" which extends from java.awt.Frame )which gives some detail information about that combination. Suppose one is selecting item 1, item 2 and item 3 from the respective lists and clicks the button and a frame will be opened showing some info and with title with a combination of these values (say item1_item2_item3). Now what I want to do is, even when the button is clicked for the same combination i.e. item 1, item 2 and item 3 respectively, I should not open a new frame, but give focus to the frame which I already opened for the same combination. Right now I am solving this problem by storing the frame object in a Hashtable with the key as item1_item2_item3.

And just now I got some idea, that I can use
Class.forName("DetailsFrame");
getClasses() which will return the array of instances of the classes and I can check for the title (i.e. item1_item2_item3), to get a correct object.
Which way will be better i.e. storing in hastable or using getClasses() method?
Thanks in advance.
Regards,
Jayakumar
[This message has been edited by Jayakumar Gopalan (edited February 16, 2001).]
 
maateen ashraf
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i couldn't get what actually u want to do....
just elaborate the snario of ur requirment
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayakumar,
Can you access the references to your frames in your Applet? i.e. are you saying something like :

or are you not able to get a reference to your frame since it is created as a local variable ( i.e. inside a method ).
If you can access the reference of the Frame look at the isVisible() or isShowing() methods in the Component class (which Frame inherits from) they return booleans and I believe they would do what you need.
If you cannot access the references of the Frames, I don't know what you could do...
HTH,
-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic