Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 8th, 2005, 06:00 PM
Registered User
 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Appending names to the textarea simultaneously

Hello,

I've designed two windows as standalone applications in swing for the client-side & a servlet for the server side.The first window is named as Login window & second as MainWindow.
Now when the user logins using my Loginwindow the user gets authenticated through my Loginservlet .If the required parameters for authentication are successfully verified then my Mainwindow code is called from the Login window.

The connection between Login window & LoginServlet is done using HttpTunneling.

My Mainwindow consists of a textarea. I want to display the names of users currently logged in that textarea.

I've made a jar for this whole thing named as login .jar.

In my first approach when only one single user logs in then I'm able to print his name in the textarea.But,when some other user executes this jar from another command prompt(for e.g) & logs in then only the second users name gets displayed in the textarea .


In my second approach when all the users logins using the same login window
when first time the jar was called & was never exited(the jar) then all the users currently logged in are visible in the textarea.

In my first case i'used a simple array while in my second case i used a static counter for my array in my separate plain java class which i made for adding the users name in the array .


But what i need is that when different- different users logs in from their individual machines using their own individual login window then also each user should be able to see the names of the users currently logged in, in their own Mainwindows'.

So how to approach for the above mentioned thing .

Thanking you,
Jignesh

 
Old April 15th, 2005, 11:05 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Maybe have your login class write to a text file, make the TextArea runnable, and update the TextArea every x minutes from the text file?


--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
 
Old May 6th, 2005, 03:29 PM
Authorized User
 
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths
Default


Okay, I think I understand what you are trying to do, will this work:

 On the Servlet side, have a static class (a class w/ static counter and static method) something like this (change the array to a vector to support unlimited users, i'm using an array because you said that's what you were using, and to simplify the example):

public class UserCounter {

  static String[] users = new String[10];
  int iCurrentUser = 0;

  static void addUser(String user){
     users[i++] = new String(user);
  }

  static String[] getUsers(){
     return users[];
  }
}

call UserCounter.addUser() from the Servlet that authenticates the user when they login, since the username ought to be available then.

Then, you can have another servlet that the client calls (on a timer or something) that gets the list of users from the server.


Regards,
Meredith Shaebanyan







Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrolling ListViews simultaneously. Saju_K .NET Framework 1.x 0 April 27th, 2007 01:50 AM
How to view more than 1 report simultaneously conn jdaulagar VB Databases Basics 0 November 30th, 2006 06:22 PM
Send/Insert data simultaneously osemollie Pro PHP 1 February 1st, 2006 05:57 AM
Multiple file download Simultaneously goodybuddy General .NET 1 January 24th, 2005 10:17 AM
display vbCrLf's from textarea to textarea mat41 Classic ASP Basics 8 June 10th, 2004 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.