This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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 :roll:
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
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. Regards, Manfred.