Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

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.
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
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.
[This message has been edited by Jayakumar Gopalan (edited February 16, 2001).]
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
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic