Hi all friends,
Iam facing a problem with changing cusor image on
applet.My applet working fine when I run it through
command "appletviewer CursorApplet.java" on
dos-prompt.But when I call that applet in html file on
IE5.5 giving me error[java.lang.noSuchMethod
found::createCustomCursor()] and when I tried it on
Netscape4.7 it giving me
error[java.lang.ClassFormatError:Bad major version
number]
I complied my CursorApplet.java by command(javac
-target 1.2 CursorApplet.java) for specified the
version of JVM.
If any one have any solution for this problem plz
extend to me.Any help will be highly appreciated.
Below r my codes:-
CursorApplet.java
===================
import java.awt.*;
import java.applet.*;
/*
<applet code="CursorApplet" width=200 height=200>
</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,
"drop");
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
//set the cursor for this applet component
setCursor(cr);
}
}
Html file
=========
<html>
<head>
<title>
Applet Example
</title>
</head>
<body bgcolor="black">
<table><tr>
<td>
<applet code="CursorApplet.class" width=200
height=200>
</applet>
</td>
</tr>
</table>
<body>
</html>
Regards
Bikash
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html