title: Help with SpringLayout?
body: <p>I have a very odd problem when I use Java's SpringLayout manager.  I'm triyng to get a tool bar to appear in my program.  It was working at an earlier point in my program and now it does not work.  Basically, if I remove the layout parameter from my instantiation of a JPanel the elements that I have added in the JPanel show up, albeit without my customizations.  If I have that parameter in the instantiation, the toolbar does not appear at all.  I have no idea what I jacked up or am doing wrong.  The JPanel is going into a central JFrame, which I've changed around from a BorderLayout to another SpringLayout to nothing and it does not seem to affect this problem.</p>
  
  <pre><code>public class purchaserApp
  {
  static JFrame mainWindow;                                   //Main window
  static JFrame addView = new JFrame ("Add An Item...");      //Add item window
  static JFrame aboutView = new JFrame ("About Purchaser");   //About window
  static JFrame helpView = new JFrame ("Purchaser Help");     //Help window
  static JPanel toolBar, contentArea, previewPane;            //Panels for GUI
  static JRootPane root;
  static JToolBar toolBar2;
  //SpringLayout mainLayout;
  JTable table;
  
  public purchaserApp()
  {
      makemainWindow();
      makeMenu();
      makeToolbar();
       // makeMainContentView();
      mainWindow.setVisible(true);
  
  }
  public void makeToolbar()
  {
      SpringLayout tbLayout = new SpringLayout();
      toolBar = new JPanel(tbLayout);     //this is the offending line of code, if I remove "tbLayout" the buttons show up in the GUI but obviously without the customizations I made below...
      JButton toolBarButtons[];
      String buttonNames[] = {"Add", "Edit", "Delete"};
      //Instantiate buttons for toolbar
      toolBarButtons = new JButton[3];
      //Resize
      Dimension d = new Dimension (40,55);
  
      //Add/modify/whatever
      for (i = 0; i &lt; 3; i++)
      {
          toolBarButtons[i] = new JButton(buttonNames[i]);
          toolBarButtons[i].setPreferredSize(d);
          tbLayout.putConstraint(SpringLayout.NORTH, toolBarButtons[i], 5, SpringLayout.NORTH, toolBar);
      }
  
      //Adjust constraints
      tbLayout.putConstraint(SpringLayout.WEST, toolBarButtons[0], 5, SpringLayout.WEST, toolBar);
      tbLayout.putConstraint(SpringLayout.WEST, toolBarButtons[1], 5, SpringLayout.EAST, toolBarButtons[0]);
      tbLayout.putConstraint(SpringLayout.EAST, toolBarButtons[2], -5, SpringLayout.EAST, toolBar);       //due to x-axis, we must go negative to get inside the frame
      for (i = 0; i &lt; 3; i++)
          toolBar.add(toolBarButtons[i]);
  
      mainWindow.add(toolBar,BorderLayout.NORTH);   //Lies! Does not add
  
  }
  </code></pre>
  
  <p>I've included here the class and the offending method.  Any help would be most greatly appreciated as I'm sure I am not the first one to have this problem. I also apologize if this is a relatively simple fix and I did not see it. I'm still sorta new to Java GUIs (and Java in general) so please excuse me.</p>