import javax.swing.*; // for JFrame
import java.awt.*;    // for FlowLayout 

public class JPanelDemo extends JFrame 
{
public JButton oneButton;
public JButton twoButton;
public JButton threeButton;
public JPanel smallWindow;

public JPanelDemo() // constructor
   {		
   setSize( 400, 100 );
   setDefaultCloseOperation(EXIT_ON_CLOSE);

   // create three buttons and a panel
   oneButton = new JButton( "One" );
   twoButton = new JButton( "Two" );
   threeButton = new JButton( "Three" );
   smallWindow = new JPanel();

 	// this is new!  
	smallWindow.setBackground( Color.blue );

	// create a layout manager and use it for
	// both the frame and the panel
	FlowLayout layout = new FlowLayout();
	setLayout( layout ); 
   smallWindow.setLayout( layout );

 	// add two buttons to the panel and one to the frame
   smallWindow.add( oneButton );
   smallWindow.add( twoButton );
   add( threeButton );

	// add the panel to the Frame
   add( smallWindow );

   // make it all visible
   setVisible(true);
   }
	 
public static void main (String [] args)
   {
	// run the constructor
   new JPanelDemo();
   }
} // end class
