• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

let me know

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have MDI Application in that i am using JFrames.What i want is when a frame is opened then another instance of the same frame should not open.
is there any method or technique to implement this. when that frame is closed then u can open that frame.
Thanks and Regards
narayana
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by narayana murthy pedapudi:
I have MDI Application in that i am using JFrames.What i want is when a frame is opened then another instance of the same frame should not open.
is there any method or technique to implement this. when that frame is closed then u can open that frame.



Use a static variable in the frame class to maintain number of active instances of the frame. If it is zero then only instantiate a new instance.
Whenever you close a frame subtract 1 from the static variable ( in the windowClosing() method of WindowListener).
This will solve your problem
 
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic