Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cursor Image on Applet???  RSS feed

Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all friends,
Iam facing a problem with changing cusor image on applet.My applet working fine when I run it through command "appletviewer" 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 by command(javac -target 1.2 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:-
import java.awt.*;
import java.applet.*;
<applet code="CursorApplet" width=200 height=200>
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 {
} catch (InterruptedException ie) {
Cursor cr = null;
//get the toolkit for this environment
Toolkit tk = getToolkit();
//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) {
//set the cursor for this applet component
Html file
Applet Example
<body bgcolor="black">
<applet code="CursorApplet.class" width=200 height=200>
Bikash :roll:
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bikash,
Browsers don't support Java 2. You will need to use the Sun Java 2 plug-in in order for you to use Java 2 methods (i.e., createCustomCursor of ToolKit).
Both browsers stopped java support at about 1.1.8.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!