waiting message

K

kastis

I'm calling remote methods on the server, where database queries are
executed.
sometimes it takes a while to get the results back to the client side.
I'm trying to display JDialog with message to wait, but while dialog
box appears immediatelly, the content inside it only appears when
remote method returns data, and that makes dialog box rather
irelevant.

what can I do to get message window displayed while waiting for data?
 
H

Harald Hein

kastis said:
I'm calling remote methods on the server, where database queries
are executed.
sometimes it takes a while to get the results back to the client
side. I'm trying to display JDialog with message to wait, but
while dialog box appears immediatelly, the content inside it only
appears when remote method returns data, and that makes dialog box
rather irelevant.

what can I do to get message window displayed while waiting for
data?

This gets asked again and again. Read the cljg FAQ (posted a month or
so ago), and read about the Swing threading model.

You might also want to learn about proper newsgroup behavior (posting
to one relevant group only instead of posting to a bunch of groups, and
reading past articles and the FAQ before posting).
 
C

Charles Fineman

You would have to launch the remote request in a different thread (which you should be doing anyway if you are currently launching the request within an Action or something like that... you are basically blocking the whole event thread by doing that). I'm no guru w.r.t. Swing thread saftey issues but I would imagine that you would still be able to call setters on the dialog from the other thread and get it to redisplay properly.
 
R

Raymond DeCampo

Charles said:
You would have to launch the remote request in a different thread (which
you should be doing anyway if you are currently launching the request
within an Action or something like that... you are basically blocking
the whole event thread by doing that).
Yes.

I'm no guru w.r.t. Swing thread
saftey issues but I would imagine that you would still be able to call
setters on the dialog from the other thread and get it to redisplay
properly.

Actually, while this usually works in practice it is technically
incorrect. If your code affects Swing components it should execute
within the Swing thread. This can be accomplished by using the
SwingUtilities.invokeLater() method.

Ray
 

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,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top