/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simpleguidemo;

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

/**
 * This is a simple demo class for a graphical user interface (GUI).
 * It is executable to allow testing.
 * 
 * @author Hans Georg Schaathun <georg@schaathun.net>
 */
public class Simpleguidemo implements ActionListener {
	
	Container mpane ;
	
	@Override
	public void actionPerformed ( ActionEvent ev ) {
		JFrame frame = new JFrame( "Foobar" ) ;
		Container c = frame.getContentPane() ;
		JLabel label = new JLabel( "Something happened." ) ;
		c.add(label) ;
		
		frame.pack() ;
		frame.setVisible(true) ;
	}
	
	public static void main(String[] args) {
		Simpleguidemo s = new Simpleguidemo() ;
	}
	
	public void makeWindow() {
		JLabel label = new JLabel( "This is the content pane." ) ;
		this.mpane.add(label) ;
		this.mpane.add( new Button( "OK" )) ;
		this.mpane.add( new Button( "Cancel" )) ;
		this.mpane.add( new JLabel( "Another label" )) ;
		this.mpane.add( new Button( "N/A" )) ;
		this.mpane.setLayout(new FlowLayout());

	}
	
	public Simpleguidemo() {
		
		JFrame frame = new JFrame( "Foobar" ) ;
		this.mpane = frame.getContentPane() ;
		
		
		makeWindow() ;
		
		
		JMenuBar mb = new JMenuBar();
		frame.setJMenuBar(mb) ;
		
		JMenu filemenu = new JMenu("File") ;
		mb.add(filemenu) ;
 
		JMenuItem item1 = new JMenuItem("Open") ;
		filemenu.add(item1) ;

		item1.addActionListener(this);
		
		frame.pack() ;
		frame.setVisible(true) ;
	}
}
