/* Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com
This code is for educational purposes only. Use at own risk.*/

1. import javax.swing.* ; 

2. import java.awt.* ; 

3.  

4. public class CursorySw 

5.     extends JApplet 

6.

7.   JButton btn ; 

8.   JLabel lbl; 

9.   JTextField tf; 

10.   Container cp; 

11.  

12.   public CursorySw ( ) 

13.   { 

14.     btn = new JButton ( "The Pressee") ; 

15.     tf = new JTextField ( 20 ); 

16.     lbl = new JLabel ( "Hot gods" ) ; 

17.   } 

18.   public void init() 

19.   { 

20.     cp = getContentPane(); 

21.     cp.setLayout( new FlowLayout() ); 

22.  

23.     btn.setCursor( 

24.      Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) ) ; 

25.     cp.add (btn); 

26.  

27.     tf.setCursor( 

28.      Cursor.getPredefinedCursor( Cursor.CROSSHAIR_CURSOR ) ); 

29.     cp.add (tf); 

30.  

31.     lbl.setCursor( 

32.      Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ) ; 

33.     lbl.setOpaque(true); 

34.     cp.add (lbl); 

35.  

36.     cp.setBackground ( Color.yellow ) ; 

37.  } 

38.

39.  

40. /*========================== 

41. Image img = getImage( getCodeBase(), "pic.gif"  ); 

42. Cursor cuscur = 

43.  Toolkit.getDefaultToolkit().createCustomCursor 

44.   ( img, new Point(0,0), "ourkersr" ); 

45. ?.setCursor( cuscur ); 

46. */ 

47.