import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class MoreComplexGUI
{
    public MoreComplexGUI()
    {
		JFrame frame = new JFrame();
		JPanel  panel  = new JPanel();
		panel.add(new JLabel("A label"));
		panel.add(new JButton("A button"));
		panel.add(new JRadioButton("A radio button"));
		panel.add(new JRadioButton("Another radio button"));
		panel.add(new JCheckBox("A checkbox", true));
		panel.add(new JTextField("A Textfield", 20));
		JLabel tlabel = new JLabel("A label with a tooltip");
		tlabel.setToolTipText("A Tooltip");
		panel.add(tlabel);
	
		frame.getContentPane().add(panel);
		frame.setTitle("Sample GUI Components");
		frame.setSize(300,200);
		frame.setVisible(true);
	
		// exit the application cleanly
		frame.addWindowListener(new WindowAdapter()
		{
	    		public void windowClosing(WindowEvent evt)
	    		{
				System.exit(0);
	    		}
		});
    }
    public static void main(String[] argv)
    {
		MoreComplexGUI mcg = new MoreComplexGUI();
    }
}
