title: Add a JScrollPane to a JFrame
body: <p>I have a question in relation to adding components to a Java frame.</p>
  
  <p>I have a JPanel with two buttons and also a JScrollPane that has a JTable added to it. I am wanting to add both these to a JFrame.</p>
  
  <p>I can add either the JPanel to the JFrame, or the JScrollPane to the JFrame and they display correctly. I am having trouble adding them both to the JFrame and displaying them both.</p>
  
  <p>Is there something related to JFrames that do not allow this? Any help will be appreciated.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The problem is not with the layout (at least I do not think that it is), the problem is that the ScrollPane is not displaying correctly. Here is an image to show what I mean:</p>
  
  <p><a href="http://canning.co.nz/Java/ScrollPane.png" rel="nofollow">http://canning.co.nz/Java/ScrollPane.png</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>    GridBagConstraints gbc = new GridBagConstraints();
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      guiPanel.add(scrollPane, gbc);
      guiPanel.add(buttons, gbc);        
  
      guiFrame.add(guiPanel, BorderLayout.CENTER);
      guiFrame.setVisible(true);
  </code></pre>