• 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

NX: How to display the "Application is Connecting" message in Network mode?

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question is for when you bring up the Network Configuration Client which asks the Host and Port to connect to. I put these values in and hit "Launch". Lets say that I put in some junk values which are valid, but the host/port do not exist and an RMI connection cannot be made.
What happens now is the the "Launch" button gets "dis-enabled" and the client GUI looks like its hung for around 10 seconds, then the popup opens up which says that the host/port cannot be found. I would like for something like "Application is connecting.... please wait" to be displayed in the status bar before it starts looking to make the connection so that the user doesn't think that the application has hung on him It seems to me that the GUI is not updating the status bar with the new label in time before which it starts to make the connection.
I tried doing an updateUI, even put a delay wait loop so that the gui could refresh itself, but it just doesn't work.
What do I do? Has anyone else encountered this situation?
Thanks,
Sanjay
[ February 15, 2004: Message edited by: Sanjay Joshi ]
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sanjay,
Did you try setting the status label text before you attempt to get the connection? for e.g.

I do not have a status bar for configuration screen but my Main gui has a status bar and it seemed to be working.
HTH
Raj
 
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sanjay,

Originally posted by Sanjay Joshi:
It seems to me that the GUI is not updating the status bar with the new label in time before which it starts to make the connection.
I tried doing an updateUI, even put a delay wait loop so that the gui could refresh itself, but it just doesn't work.
What do I do? Has anyone else encountered this situation?


Been there, done that. You're trying to do non-trivial work (it's taking about 10 seconds to make the connection) using the Swing event-handling thread. Take a look at this thread topic: Topic: JFrame not repainting when overlayed JDialog is closed . I think you're going to want to spawn a new thread (other than the Swing event-handling thread) that will make the connection. This will allow the Swing event-handling thread to refresh the GUI as you're expecting. If after looking at the referenced topic you still have questions, let me know.
Hope this helps,
George
[ February 15, 2004: Message edited by: George Marinkovich ]
 
amchi gelo
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Raj, yes, I tried that, it didn't work.
George, thanks for your reply yet again! I'll look at the thread you quote and see if that works.
Sanjay
 
amchi gelo
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
George, I tried a threads solution and I get the desired result.
The way I have done it is I spawn one thread to get the remote connection and another thread to contain an infinite loop to check the errorcode I generate in the first thread depending on whether the connection is successful or throws an exception. When it gets this from the first thread, the second thread breaks out of the loop and calls the code to run the main GUI which contains the JTable etc...
Any better solutions? I tried to think up one with just 1 thread, but I couldn't arrive at one which runs outside the Swing thread and achieves all that I want to.
Sanjay
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic