setting cursor

V

vertigo

Hello
i tried:
this.setCursor(new Cursor(HAND_CURSOR));
or:
this.setCursor(Cursor.HAND_CURSOR);

but i always receive when compiling that it's
deprecated API. How can i do it in new API ?

Thanx
Michal
 
M

Michael Rauscher

Hi Michal,
Hello
i tried:
this.setCursor(new Cursor(HAND_CURSOR));
or:
this.setCursor(Cursor.HAND_CURSOR);

but i always receive when compiling that it's
deprecated API. How can i do it in new API ?

Which version of the API (btw, the API should show what to use instead)
in which class?
Thanx
Michal

Bye
Michael
 
B

Brian Ban

vertigo said:
Hello
i tried:
this.setCursor(new Cursor(HAND_CURSOR));
or:
this.setCursor(Cursor.HAND_CURSOR);

but i always receive when compiling that it's
deprecated API. How can i do it in new API ?

Thanx
Michal

What type of component is "this"?
 
V

vertigo

Michael said:
Which version of the API (btw, the API should show what to use instead)
in which class?

i use java 1.4.1, when i compiled i receive:
G:\gry\IRC\x\highland\ppoj>javac *.java -deprecation
ListWin.java:36: warning: HAND_CURSOR in java.awt.Frame has been deprecated
this.setCursor(new Cursor(HAND_CURSOR));
^
1 warning

Why ? How can i solve this problem ?

Thanx
 
B

Bjorn Abelli

...

In this line the HAND_CURSOR constant in Frame is deprecated.

In this line the overload method setCursor(int) in Frame is deprecated.

Either you could do:

this.setCursor(
new Cursor(Cursor.HAND_CURSOR));

or...

this.setCursor(
Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

// Bjorn A
 
M

Michael Rauscher

vertigo said:
i use java 1.4.1, when i compiled i receive:
G:\gry\IRC\x\highland\ppoj>javac *.java -deprecation
ListWin.java:36: warning: HAND_CURSOR in java.awt.Frame has been deprecated
this.setCursor(new Cursor(HAND_CURSOR)); ^
1 warning

Why ? How can i solve this problem ?

Why what?

Why the compiler claims that it is deprecated? Because it's specified to
be deprecated.

Or why the compiler uses Frame.HAND_CURSOR? Because obviously you make
the call from within an object that is an instance of a subclass of
java.awt.Frame.

Do you have the API? If not download it - you'll need it anytime,
anywhere ;-)

If you have a look at the field summary of java.awt.Frame in the API,
you'll see that there is written:

Deprecated. replaced by Cursor.HAND_CURSOR

All you have to do is to replace new Cursor(HAND_CURSOR) by new
Cursor(Cursor.HAND_CURSOR)

Bye
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top