/* 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 BLSw 

5.     extends JApplet 

6.

7.   JButton btn, btn2 ; 

8.   JLabel lbl ; 

9.   JTextField tf ; 

10.   Container cp ; 

11.  

12.   public BLSw ( ) 

13.   { 

14.     btn = new JButton ( "You can click me, but don't feel obligated" ) ; 

15.     btn2 = new JButton ( "Hello.................." ) ; 

16.     tf = new JTextField ( "Move those fingers" ); 

17.     lbl = new JLabel ( "This is too much, I need therapy" ) ; 

18.   } 

19.  

20.   public void init() 

21.   { 

22.     cp = getContentPane() ; 

23.     cp.setLayout ( new BorderLayout ( 5,10 ) ) ; 

24.  

25.     cp.add ( btn, BorderLayout.NORTH ) ; 

26.     cp.add ( tf, BorderLayout.SOUTH ) ; 

27.     cp.add ( btn2, BorderLayout.EAST ) ; 

28.  

29.     cp.setBackground ( Color.green ) ; 

30.  

31.     lbl.setBackground ( Color.orange ) ; 

32.     lbl.setOpaque( true ); 

33.     cp.add ( lbl, BorderLayout.CENTER ) ; 

34.   } 

35.