Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

createCustomCursor

Status
Not open for further replies.

daniel87dec

Technical User
Jan 7, 2004
9
CA
Please give me an example of how to create a mouse cursor.
 
Please provide more information (Swing application, browser etc) or search google.
 
import java.applet.*;
import java.awt.*;

public class TutorialExample extends Applet{
//Declaire variables needed to make the cursor
Cursor myCursor;
Image cursorImage;
Point hotPoint;

//A init method that makes and sets the cursor
public void init(){
cursorImage = getImage(getCodeBase(), "1.jpg");
Toolkit tk = getToolkit();
hotPoint = new Point(6,0);
myCursor = tk.createCustomCursor(cursorImage,hotPoint,"This is my custom Cursor");
setCursor(myCursor);
}//End init()

//The drawn part of the applet
public void paint(Graphics g){
g.setColor(Color.red);
}//End paint()
}//End TutorialExample
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top