Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

let me know

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic