Article View: borland.public.jbuilder.java.swing
Article #12951Re: Can anyone help with a problem on Cursors?
From: Jan Vasternas
Date: Mon, 12 Oct 1998 00:00
Date: Mon, 12 Oct 1998 00:00
39 lines
1693 bytes
1693 bytes
Peter
I have the same problem.
Have tried something like this and it seems to work.
In the button event method:
set cursor to WAIT_CURSOR
perform any other gui changes ( set status bar message etc.)
invoke "network stuff" method in another Thread.
in the "network stuff" method
do network stuff
invoke a "gui-update" method in the event thread, by using
SwingUtilities.invokeLater(Runnable)
in the "gui-update" method
update gui with new info from network
set cursor to DEFAULT_CURSOR
jan
Peter Hawkins wrote in message <3621FD6E.D0213F03@hos.horizon.ie>...
>Hi,
>
>I have a swing application which reacts to a button press by calling a
>method in another class. This method makes a network connection to
>another host, retrieves some data and returns. I thought that it would
>be good to set the cursor to the WAIT_CURSOR before the method call and
>reset it on return to give the user some indication that something is
>happening.
>
>However I find that the cursor does not get updated until the method
>returns, in which case it immediatly gets set back again. The code looks
>something like this:
>
Technical Details
Message-ID:
<6vt2u0$d018@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3621FD6E.D0213F03@hos.horizon.ie>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f440fe083c1ad20c X-Google-Attributes: gid111d45,public From: "Jan Vasternas" <jan@vasternas.se> Subject: Re: Can anyone help with a problem on Cursors? Date: 1998/10/12 Message-ID: <6vt2u0$d018@forums.borland.com> X-Deja-AN: 400255389 References: <3621FD6E.D0213F03@hos.horizon.ie> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing