import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JLabel;

public class Test extends JFrame {
	
	public static void main(String[] args){new Test();}
	
	public Test(){
		super("Test");
		
		addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){System.exit(0);}
		});

		// Menu
		JMenuBar mb=new JMenuBar(); setJMenuBar(mb);
		JMenu file=new JMenu("File"); mb.add(file);
		JMenuItem file_quit=new JMenuItem("Quit");
		file_quit.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){System.exit(0);}
		});
		file.add(file_quit);
		
		// Panels
		setLayout(new GridLayout(2,1));
		add(new JTextField());
		add(new JLabel("Hello World"));
		
		pack();
		setVisible(true);
	}
}
