-
Bug
-
Resolution: Fixed
-
P4
-
1.0
-
1.1
-
x86
-
windows_95
-
Not verified
The solaris implementation of setCursor() works correctly, but as this example demonstrates a mouse movement must occur before setCursor() takes effect under WindowsNT/95.
import java.awt.*;
class CursorTest extends Frame {
CursorTest() {
add("Center", new Button("change cursor"));
pack();
show();
}
public boolean handleEvent(Event e) {
if (e.id == Event.WINDOW_DESTROY) System.exit(0);
if (e.target instanceof Button) {
setCursor(Frame.WAIT_CURSOR);
getToolkit().sync();
System.out.println("wait cursor");
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {}
setCursor(Frame.DEFAULT_CURSOR);
getToolkit().sync();
System.out.println("default cursor");
return true;
}
return false;
}
public static void main(String args[]) {
new CursorTest();
}
}
import java.awt.*;
class CursorTest extends Frame {
CursorTest() {
add("Center", new Button("change cursor"));
pack();
show();
}
public boolean handleEvent(Event e) {
if (e.id == Event.WINDOW_DESTROY) System.exit(0);
if (e.target instanceof Button) {
setCursor(Frame.WAIT_CURSOR);
getToolkit().sync();
System.out.println("wait cursor");
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {}
setCursor(Frame.DEFAULT_CURSOR);
getToolkit().sync();
System.out.println("default cursor");
return true;
}
return false;
}
public static void main(String args[]) {
new CursorTest();
}
}