Swing Dialogs and Remote Asynchronous responses ?

S

swebb99

Hi,

I've done a fair bit with swing and whenever there is some heavy
backend work I make use of swingworker to help me out. However I am
working on a system at the moment where the result of pressing ok in a
Jframe results in a message being sent to a remote box and the
confirmation result comes back aysnchronously via another message. I
want to display success or fail via a dialogue but while waiting stop
the use from being about to use the GUI and also popup a busy cursor.
Also if after a specified time the response message doesn't appear
display fail in the dialog.

Anybody come across this problem before, have any tips, links ?????

Thanks in advance

Steve
 
V

Vova Reznik

Hi,

I've done a fair bit with swing and whenever there is some heavy
backend work I make use of swingworker to help me out. However I am
working on a system at the moment where the result of pressing ok in a
Jframe results in a message being sent to a remote box and the
confirmation result comes back aysnchronously via another message. I
want to display success or fail via a dialogue but while waiting stop
the use from being about to use the GUI and also popup a busy cursor.
Also if after a specified time the response message doesn't appear
display fail in the dialog.

Anybody come across this problem before, have any tips, links ?????

Thanks in advance

Steve
You may cover your JFrame with glass pane
(see JFrame#setGlassPane(Component))
with any cursor and in the same time start
swing Timer with delay you want. Timer will set
glass pane invisible after "specified time".
Don't forget to add to your glass pane all empty mouse and key listener
to block any user interaction.
 
S

swebb99

Thanks for that Vova that would seem to work for what I want the only
thing I would have to add is a mechanism for associating the response
coming back with the GUI component awaiting the response.

Cheers

Steve
 
V

Vova Reznik

Thanks for that Vova that would seem to work for what I want the only
thing I would have to add is a mechanism for associating the response
coming back with the GUI component awaiting the response.

Cheers

Steve
Simple call back function. You may use delegate
in SwingWorker#finished().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top