Article View: borland.public.jbuilder.java.language
Article #18454Re: Hourglass
From: Tad Frysinger
Date: Tue, 23 Jun 1998 00:00
Date: Tue, 23 Jun 1998 00:00
59 lines
1757 bytes
1757 bytes
In article <6mkcif$fu77@forums.borland.com>, stciney.k@synergy-int.co.nz
says...
> Hi,
>
> How can I display a hourglass when I run a program. I want to display a
> hourglass when a program is run form the mainmenu and when reports are run
>
> Thanks,
> Stickney
>
>
>
Under Win32, it is best to set the cursor using a frame. When I have a
bean that needs to set the cursor, I call this static method I have in a
"FZUtils" class:
Cursor oldCursor = FZUtils.doSetCursor(
Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR ) );
.
.
.
FZUtils.doSetCursor( oldCursor );
The code for implementing the above is:
public static Cursor doSetCursor( Cursor cur, Container con ) {
Frame parent = getFirstFrame(con);
Cursor current = con.getCursor();
if (parent != null ) {
current = parent.getCursor();
parent.setCursor( cur );
}
return current;
}
public static Frame getFirstFrame(Container con) {
java.awt.Container cObj;
Frame frameObj = null;
for (cObj = con.getParent(); cObj != null; cObj = cObj.getParent()) {
if (cObj instanceof Frame) {
frameObj = (Frame)cObj;
break;
}
}
return frameObj;
}
HTH -
Tad
Technical Details
Message-ID:
<MPG.ff9865549b5ebb1989860@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6mkcif$fu77@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,2da5f6e4f3db8daf X-Google-Attributes: gidf74b3,public From: tfrysinger@earthlink.net (Tad Frysinger) Subject: Re: Hourglass Date: 1998/06/23 Message-ID: <MPG.ff9865549b5ebb1989860@forums.borland.com> X-Deja-AN: 365353230 References: <6mkcif$fu77@forums.borland.com> Organization: FreeZone Enterprises Newsgroups: borland.public.jbuilder.java.language