public static Cursor makeCursor ( String name ) { Image image = getImage ( name ) ; if ( null == image ) return null ; Cursor cursor ; try { Toolkit tk = Toolkit . getDefaultToolkit ( ) ; if ( debug ) { ImageObserver obs = new ImageObserver ( ) { public boolean imageUpdate ( Image image , int flags , int x , int y , int width , int height ) { return true ; } } ; System . out . println ( " bestCursorSize = " + tk . getBestCursorSize ( image . getWidth ( obs ) , image . getHeight ( obs ) ) ) ; System . out . println ( " getMaximumCursorColors = " + tk . getMaximumCursorColors ( ) ) ; } cursor = tk . createCustomCursor ( image , new Point ( 17 , 17 ) , name ) ; } catch ( IndexOutOfBoundsException e ) { System . out . println ( "NavigatedPanel createCustomCursor failed " + e ) ; return null ; } return cursor ; }
Get a gif file make it into a Cursor .