It used to be in 1.0.2 that you could only set a cursor
for the whole window. Now in JDK 1.1 its per component.
If a component explicitly sets a cursor, it overrides the value inherited
from its parent window.
Only text components seem to do this in the core AWT.
One consequence is that if using the old 1.0 semantics a programmer
sets a cursor on the frame to indicate (in this case) that a window
is busy, then the busy cursor is overridden when the pointer moves
over a component which has explicitly set a cursor.
The programmer likes being able to set a per-component cursor
but also wants a way to get the old behaviour too.
Test case below, note that the cursor on the TextField is a caret.
import java.awt.*;
public class CursorTest extends Frame
{ Button b;
Panel p;
public CursorTest()
{
p = new Panel();
setLayout(new FlowLayout());
p.add(b=new Button("Button1"));
p.add(new Label("Label1"));
p.add(new Checkbox("Checkbox"));
p.add(new TextField("Button1"));
add("Center",p);
pack();
reshape(100,100,300, 400);
show();
setCursor(new Cursor(Cursor.WAIT_CURSOR));
}
public static void main(String[] args)
{
new CursorTest();
}
}