/* 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 java.awt.event.*; 

2. import java.awt.*; 

3.  

4. public class Adapt 

5.     extends java.applet.Applet 

6.

7. //// inner class MA : //// 

8.  

9.   class MA extends MouseAdapter 

10.   { 

11.     public void mouseClicked ( MouseEvent   ev  ) 

12.     { 

13.       count++; 

14.       repaint (); 

15.     } 

16.   } ///end inner class MA 

17.  

18.   int count = 0

19.  

20.   public Adapt () 

21.   { 

22.     addMouseListener ( new MA() ) ; 

23.  

24.     setBackground ( Color.pink ) ; 

25.   } 

26.  

27.   public void paint ( Graphics   gr ) 

28.   { 

29.     gr.drawString ( "Counter is now " + count , 75, 30  ); 

30.   } 

31.