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

6.     extends JPanel 

7.

8.  

9.   JTextField tf = new JTextField ( 20 ) ; 

10.   JButton bt = new JButton ( "Under pressure" ) ; 

11.  

12.   public SwSA() 

13.   { 

14.     setLayout ( new FlowLayout() ); 

15.  

16.     add ( tf ); 

17.     add (  bt ) ; 

18.   } 

19.  

20.   public static void main ( String[] args ) 

21.   { 

22.     SAFrame frame = new SAFrame(); 

23.     frame.setContentPane(  new SwSA()  ); 

24.     frame.setVisible (true); 

25.   } 

26.

27. class SAFrame extends JFrame 

28.

29.   public SAFrame( ) 

30.   { 

31.     addWindowListener ( 

32.       new WindowAdapter ( ) 

33.       { 

34.          public void windowClosing ( WindowEvent ev ) 

35.            { System.exit(0); } 

36.       } 

37.      ); 

38.     setSize ( new Dimension ( 600, 200 )  ); 

39.     setTitle("You'll never stand alone"); 

40.   } 

41.

42.