This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Only one instance!  RSS feed

 
Mohamad Obagi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!