title: How do i implement a Jbutton and event listener to close the application?
body: <p>The following is my code...the jButton would be added in the GuI method. I need a jbutton to add to the container and an eventlistener to enable the application to close when pushed. </p>
  
  <pre><code>public class BeetsWk1 extends JFrame{
  
  public BeetsWk1(){
  
       GuI();
  }
  
  public void GuI(){
        FlowLayout layout = new FlowLayout();
  
          layout.setAlignment(FlowLayout.CENTER);
  
      Container container;
      container = getContentPane();
      container.setBackground(new Color(052,062,138));
      container.setLayout(layout);
  
      JLabel label = new JLabel();
      label.setText ("Hello World" );
      label.setSize( 500, 400);
              label.setFont( new Font( "SanSerif", Font.PLAIN, 15) );
              label.setHorizontalAlignment( JLabel.CENTER );
      label.setForeground(Color.white);
      container.add( label );
  }
  
      public static void main(String[] args) {
          // TODO code application logic here
              Dimension dimension = new Dimension(500, 500);
                          BeetsWk1 window = new BeetsWk1();
                         window.setVisible(true);
                          window.setSize(dimension);
                             window.setDefaultCloseOperation(window.EXIT_ON_CLOSE);
      }
  
      private Dimension Dimension(int i, int j) {
          throw new UnsupportedOperationException("Not yet implemented");
      }
  }
  </code></pre>