import javax.swing.*;
import java.awt.*;
import java.io.File;

public class CursorDemo extends JFrame {
    
    public CursorDemo() {
	Container cp = getContentPane();
	cp.setLayout(new FlowLayout());
	JButton b1 = new JButton("HAND");
	b1.setCursor(new Cursor(Cursor.HAND_CURSOR));
	cp.add(b1);
	JButton b2 = new JButton("WAIT");
	b2.setCursor(new Cursor(Cursor.WAIT_CURSOR));
	cp.add(b2);
	JButton b3 = new JButton("Custom");
	try {
	    Cursor c = Cursor.getSystemCustomCursor("banana");
	    if (c == null) {
		ImageIcon icon = new ImageIcon("images" + File.separator + "draggedfolder.gif");
		Image cursorImage = icon.getImage();
		b3.setIcon(icon);
		Point hotspot = new Point(14,14);
		String name = "myCursor";
		c = b3.getToolkit().createCustomCursor(cursorImage,hotspot,name);
	    }
	    b3.setCursor(c);
	} catch (Exception e) {
	    e.printStackTrace();
	}
	cp.add(b3);
	JButton b4 = new JButton("TEXT");
	b4.setCursor(new Cursor(Cursor.TEXT_CURSOR));
	cp.add(b4);
	

    }
    
    public static void main (String[] args) {
	JFrame f = new CursorDemo();
	f.setSize(600,400);
	f.setVisible(true);
	f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
