• 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

Only one instance!

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to enable only one instance of chat per user, i mean by that no to let the user open more than window

like in messenger your allowed to open one window.


? any idea guys
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the Java in General (intermediate) forum there is at least one good topic about only allowing one instance of an application. If you use the search I'm sure you'll be able to find it.

Inside your application it's a lot easier. Keep a mapping of users to their chat windows. If you want to open a new chat window, check if there already is a chat window for the user. Only if it's not the case you should create the window and of course add the mapping.
Don't forget to remove the mapping if the window is closed though (tip: use a WindowListener).
reply
    Bookmark Topic Watch Topic
  • New Topic