

Make the unzipped AniCursorDemo directory the current.You will need to compile all of these filesīefore you can run this application. This article’s code archive contains AniCursorDemo.java and

The Stop button’s action listener tells the AniCursor instance to Previously specified label, the animated cursor will appear over this component. It’s also initialized with a reference toĪ label component, which is associated with the animated cursor.Īfter creating the AniCursor instance, the listener tells this Represents an animated cursor, is initialized with the name (and optional path) Within the action listener assigned to the Start button. G.fillRect (0, 0, getWidth (), getHeight ()) ĪniCursorDemo creates a singleton AniCursor instance from Paint a nice gradient background with white at the top and pink at Gp = new GradientPaint (0, 0, Color.white, 0, New AniCursorDemo (args.length = 0 ? null : args ) Public static void main (final String args) Gpanel.add (label = new JLabel ("Animated cursor only appears over this "+ Public void actionPerformed (ActionEvent ae)Īnicursor = new AniCursor (aniName, label) SetDefaultCloseOperation (EXIT_ON_CLOSE) įinal JButton btnStart = new JButton ("Start") Public AniCursorDemo (final String aniName) Public class AniCursorDemo extends JFrame Listing 1 presentsĪniCursorDemo’s source code. Takes care of animating these images over a label component. It also uses the library to start and stop an animation thread, which ani (animated cursor) file identified via the command This program uses the library to extract cursor images from a The AniCursorDemo Swing application demonstrates the animated cursor The library is also compilable with J2SE 5.x, and usable on other I built and tested this article’s code with Java SE 6 on a Windows XP
