/* 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. import java.applet.*; 

4.  

5. public class Inherit 

6.     extends Applet 

7.     implements ActionListener 

8.

9.   Button butt ; 

10.  

11.   public void actionPerformed ( ActionEvent ev ) 

12.   { 

13.     setBackground ( Color.cyan ) ; 

14. //    Component.setBackground ( Color.cyan ) ; 

15.  

16.     butt.setLabel ( "Ouch, not that hard !" ) ; 

17.   } 

18.  

19.   public Inherit () 

20.   { 

21.     butt = new Button ( "Press me, if you please" ) ; 

22.   } 

23.  

24.   public void init() 

25.   { 

26.  

27.     butt.addActionListener ( this ) ; 

28.     setBackground ( Color.pink ) ; 

29. //    Component.setBackground ( Color.pink ) ; 

30.  

31.     add ( butt ) ; 

32. //    Container.add ( butt ) ; 

33.     validate () ; 

34. //    Container.validate () ; 

35.   } 

36.