Hi all friends,
I am facing problem with changing cursor image I want to change my cursor image for my website home page for that I write a
applet programme it is running fine with "appletviewer" command on dos-prompt but when i call that applet file in html file through applet tag then browser giving me "error:java.lang.noSuchMethod found in java.awt.Toolkit 'createCustomCursor()'".I tried it on IE5,IE5.5 & Netscape4.7 all r giving same error but I couldn't understand why it is giving me this error.Can any one plz tell why this error.Any help will be highly appreciated.
Below r my codes:-
Applet file:-
-------------
import java.awt.*;
import java.applet.*;
public class CursorApplet extends Applet {
public void init() {
//load the image with the Media Tracker
MediaTracker tracker = new MediaTracker(this);
Image cursor = getImage(getCodeBase(), "drop.gif");
tracker.addImage(cursor, 1,16,24);
try {
tracker.waitForID(1);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
Cursor cr = null;
//get the toolkit for this environment
Toolkit tk = getToolkit();
try
{
//this is the x,y coordinates of the image which
//will actually do the "clicking"
Point hotSpot = new Point(1, 1);
//create the custom cursor
cr = tk.createCustomCursor(cursor, hotSpot, "music_note");
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
//set the cursor for this applet component
setCursor(cr);
}
}
html file:-
-----------
<html>
<head>
<title>An Example</title>
</head>
<body bgcolor="black">
<applet code="CursorApplet.class" width=200 height=200>
</applet>
<body>
</html>
Regards
Bikash