How Do I limit the Number of Frame instances?
1 posts in topic
Flat View  Flat View

Posted By:   J_A
Posted On:   Friday, July 19, 2002 12:17 AM

I am doing one applet in which a JTable displays some of the details and by clicking on each row, a different pop up window (JFrame) appears that contains more details of the record in each row. I found a problem like if we click on the same record more than once that many windows will open. Is there any way to limit the JFrame instance one for each row ?

Re: How Do I limit the Number of Frame instances?

Posted By:   Gautam_Marwaha  
Posted On:   Friday, July 19, 2002 02:01 AM

If you want to allow multiple pop ups, max one per record then you may have to maintain (row no. - JFrame object) pairs in some collection. Every time a user clicks a record, check the collection to see if an entry for that particular rows exists in the collection. If it does, use the associated JFrame to show the data. If not, create a new JFrame, put an entry in the collection for that row and the new frame, show the data in the new frame.

If you want to limit the pop ups to one - max. one pop up open at any time:

make the JFrame object as a member. Before opening up the JFrame, check if it is already open. If not, open it. If it is open, populate it with the reqd. data.

About | Sitemap | Contact