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

4.  

5. public class BorderSizeSw 

6.     extends JApplet 

7.

8.   JLabel lb = new JLabel ( "Just text" ) ; 

9.   JComponent cp ; 

10.  

11.   public void 

12.   init() 

13.   { 

14.     cp = (JComponent) getContentPane(); 

15.     cp.setBorder( 

16.        BorderFactory.createEmptyBorder( 20,60,110,180 ) ); 

17.  

18.     lb.setBackground ( Color.white ) ; 

19.     lb.setOpaque(true); 

20.     cp.setLayout ( new BorderLayout ( ) ) ; 

21.     cp.add ( lb, BorderLayout.CENTER ) ; 

22.     cp.setBackground ( Color.cyan ) ; 

23.   } 

24.