title: Adding a JScrollPane to JDialog
body: <p>I have a working <code>JDialog</code> and now I want to add scroll bars to it. The documentation is a bit confusing to me. Do I add the dialog to the <code>JScrollPane</code> or vice-versa? </p>
  
  <p>It seems like all the examples have a <code>JPanel</code> in the dialog and the panel is scrollable. I have a dialog that grows dynamically so I want the dialog itself to be scrollable. Can someone point me in the right direction?</p>
  
  <p><strong>Reply to Andrew Thompson</strong></p>
  
  <p>Thanks for the reply.</p>
  
  <p>I let the size be determined by the layout manager at this point. I'm not exactly sure yet how big to let it get yet so I have not set any sizes. It just grows as I add rows. That will be part of this development phase. The width will not change, just the height. I display the dialog using 'invokelater'. This is the relevant code:</p>
  
  <pre><code>timeLineDialog = new JDialog();
  timeLineDialog.setLayout(layout);
  timeLineDialog.setModalityType(ModalityType.MODELESS);
  timeLineDialog.setTitle("Time Line Settings");
  timeLineDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
  .
  .
  .
  timeLineDialog.pack();
  timeLineDialog.setLocationRelativeTo(GUI.getInstance().getFrame());
  timeLineDialog.setVisible(true);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lh13H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lh13H.png" alt="enter image description here"></a></p>
  
  <p>I want the scroll bars on the right side of the dialog pane.</p>