title: How to set JPanel fixed size such that the JScrollPane (scrolling) appears?
body: <p>I'm working on a little code. <code>JFrame</code> containing a <code>JPanel</code> with specific dimensions. Here is my code:</p>
  
  <pre><code>import javax.swing.*; 
  import java.awt.*; 
  
  public class ScrollPane extends JFrame { 
  
      public ScrollPane() {
          super("Title");
          setLayout(new BorderLayout());
          setSize(320,240);
  
          JScrollPane scroller = new JScrollPane(new DrawingPane()); 
          scroller.setPreferredSize(new Dimension(320,240)); 
  
          add(scroller); 
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setVisible(true);
      } 
  
      private class DrawingPane extends JPanel {
          public DrawingPane(){
              super();
              setSize(640,480);
              setMinimumSize(new Dimension(320,240));
          }
  
      }
  
      public static void main(String[] args) {
          new ScrollPane();
      } 
  }
  </code></pre>
  
  <p>Even with a minimum size set for the <code>JPanel</code>, the scrolls don't appear. </p>