Article View: borland.public.jbuilder.java.swing
Article #12964Re: Can anyone help with a problem on Cursors?
From: Peter Hawkins
Date: Tue, 13 Oct 1998 00:00
Date: Tue, 13 Oct 1998 00:00
76 lines
2601 bytes
2601 bytes
I maged to get the Cursor update Ok by wrapping the work stuff in a new
thread like this:
<Event handler>
Set the cursor to wait.
Thread WorkThread - new Thread (){
public void run(){
... work stuff
Set the cursor back to default
}
}
WorkThread.start();
However I find that I have to set the cursor on each component in the JFrame
as setting the cursor on a Frame is deprecated. What is the new way to set
the cursor on an entire JFrame?
Peter Hawkins wrote:
> 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:
>
> <In the button event handler>
>
> ResponseArea.setCursor(new Cursor(WAIT_CURSOR));
>
> ---> call the method which does the network stuff.
>
> ResponseArea.setCursor(new Cursor(DEFAULT_CURSOR));
>
> <end of button handler>
>
> When run it acts like this:
>
> <In the button event handler>
>
> ---> call the method which does the network stuff.
>
> ResponseArea.setCursor(new Cursor(WAIT_CURSOR));
> ResponseArea.setCursor(new Cursor(DEFAULT_CURSOR));
>
> <end of button handler>
>
> It seems like the ResponseArea component (JTextPane) has to wait on the
> method call finishing before it can update the cursor by which time it
> is too late.
>
> Anyone have any ideas
>
> Thanks
> --
> Peter Hawkins
>
> ______________________________________________________________
> Horizon Open Systems The Sidings Office Park
> Mail : Peter.Hawkins@HOS.Horizon.ie Antrim Road
> Url : http://www.hos.horizon.ie Lisburn
Technical Details
Message-ID:
<3623C799.BBC2700@greer.demon.co.uk>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: Peter Hawkins <peter@greer.demon.co.uk> Subject: Re: Can anyone help with a problem on Cursors? Date: 1998/10/13 Message-ID: <3623C799.BBC2700@greer.demon.co.uk> X-Deja-AN: 400760015 Content-Transfer-Encoding: 7bit References: <3621FD6E.D0213F03@hos.horizon.ie> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing