• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Any ideas or concepts??

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi gurus,
I am having a parent class(ParentWin), inside this i
will create an object of child class(ChildWin).
My requirements comes like if i create one more instance of parent class(ParentWin),child class should not be created.Once an object of child class(ChildWin)is created it should not be instantiated again..Can you please suggest for single instance
of childWin at any point of time...

ParentWin---- mainwindow
ChildWin ---- childwindow created
from main window.
So when i create one more instance of Parent window( 2nd instance) and try to create child window, the earlier created child window should be shown, so new creation should happen

advance thanks for Suggestions.
Thanks&Regards,
selva.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mmh, looks like you need to implement the singleton pattern... (and this has nothing to do with Swing/JFC/AWT)
have a look here:
GoF singleton pattern
Singleton in Java
your ChildWin will implement the singleton pattern, and when ParentWin wants to get a ChildWin, it will call the instance() method
[This message has been edited by PierreArnaud Galiana (edited June 23, 2001).]
 
selvas kumars
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi PierreArnaud,
thanks for this useful site.
Regards,
silva.
 
selvas kumars
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi PierreArnaud ,
thanks for the reply and i had implemented it.
Regards,
silva.
 
Get me the mayor's office! I need to tell him about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic