title: Displaying a scroll bar only when necessary
body: <p>I'd like to do something like the following:</p>
  
  <pre><code>    public class MyCustomDialog extends JDialog 
      {
  
         public MyCustomDialog()
         {
            if (getClientVertScreenSize() &lt; 800)
            {
              // Set the vertical size as 600, and give them a scroll pane to navigate to the bottom of the gui.
            }
            else
            {
               setSize(600, 800); // No need to add a scroll pane.
            }
         }
  
      }
  </code></pre>
  
  <p>The trouble is I don't know how to check the clients' screen size, so I don't know how to write the method my constructor relies on.</p>