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

6.     extends JApplet 

7.

8.   JTabbedPane tp ; 

9.  

10.   JPanel p1, p2 ; 

11.  

12.   public void init ( ) 

13.   { 

14.     tp = new  JTabbedPane ( ); 

15.  

16.     p1 = new JPanel ( ) ; 

17.     p2 = new JPanel ( ) ; 

18.  

19.     lbl = new JLabel( "Ain't worth a thing ..." ); 

20.     tf = new JTextField ( 20 ); 

21.     bt = new JButton ( "JLessons button" ) ; 

22.  

23.     lbl.setBackground ( Color.cyan ) ; 

24.     lbl.setOpaque ( true ) ; 

25.  

26.     p1.add ( lbl ) ; 

27.     p1.add ( tf ) ; 

28.  

29.     p2.add ( bt ) ; 

30.  

31.     tp.addTab ( "Erste", p1 ) ; 

32.     tp.addTab ( "Zweite", p2 ) ; 

33.  

34.     getContentPane().add ( tp ) ; 

35.   } 

36.  

37.   JLabel lbl ; 

38.   JTextField tf ; 

39.   JButton bt ; 

40.