title: Some doubts related to the use of the BorderLayout object
body: <p>I am studying Java Swing and I have a doubt related to the use of the <strong>BorderLayout</strong> object.</p>
  
  <p>I have this simple example program that create a ToolBar:</p>
  
  <pre><code>package com.andrea.menu;
  
  import java.awt.BorderLayout;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.ImageIcon;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JMenu;
  import javax.swing.JMenuBar;
  import javax.swing.JToolBar;
  import javax.swing.SwingUtilities;
  
  public class ToolBar extends JFrame {
  
      public ToolBar() {
          initUI();
      }
  
      public final void initUI() {
  
          JMenuBar menubar = new JMenuBar();      // The menu bar containing the main menu voices
          JMenu file = new JMenu("File");         // Creo un menu a tendina con etichetta "File" e lo aggiungo
          menubar.add(file);
  
          setJMenuBar(menubar);                   // Sets the menubar for this frame.
  
          JToolBar toolbar = new JToolBar();
  
          ImageIcon icon = new ImageIcon(getClass().getResource("exit.png"));
  
          JButton exitButton = new JButton(icon);
          toolbar.add(exitButton);
          exitButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent event) {
                  System.exit(0);
              }
  
          });
  
          add(toolbar, BorderLayout.NORTH);
  
          setTitle("Simple toolbar");
          setSize(300, 200);
          setLocationRelativeTo(null);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
      }
  
      public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                  ToolBar ex = new ToolBar();
                  ex.setVisible(true);
              }
          });
      }
  }
  </code></pre>
  
  <p>So it create a <strong>JToolBar</strong> object by the line:</p>
  
  <pre><code>JToolBar toolbar = new JToolBar();
  </code></pre>
  
  <p>and then it put it in the <strong>NORTH</strong> position of the <strong>BorderLayout</strong> object by the line:</p>
  
  <pre><code>add(toolbar, BorderLayout.NORTH);
  </code></pre>
  
  <p>Reading the documentation I know that:</p>
  
  <blockquote>
    <p>A border layout lays out a container, arranging and resizing its
    components to fit in five regions: north, south, east, west, and
    center</p>
  </blockquote>
  
  <p>My doubt is: the <code>BorderLayout</code> object whom it refers? At the external <strong>JFrame</strong> container?</p>
  
  <p>It means that it puts the <strong>toolbar</strong> object in the NORTH position of my <strong>JFrame</strong>? Or what?</p>