File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Cursor Image on Applet??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Cursor Image on Applet???" Watch "Cursor Image on Applet???" New topic

Cursor Image on Applet???

Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
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

Joined: Jan 09, 2001
Posts: 1492
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.
I agree. Here's the link:
subject: Cursor Image on Applet???