title: JViewerPane inside a JScrollPane
body: <p>I have a JEditorPane that I need to attach a scrollbar to. I am attempting to nest the JEditorPane inside a JScrollPane. Here I provide an SSCCE.</p>
  
  <pre><code>import java.awt.Dimension;
  import javax.swing.*;
  
  public class Test{
  
      public static void main(String[] args){
          JFrame frame = new JFrame();
  
          //Generate filler text to illustrate the lack of a scrollbar
          String fillerText = "";
          for(int i = 0; i &lt; 500; i++){
              fillerText += "The quick brown fox jumped over the lazy dog. ";
          }
  
          //Initialize JEditorPane
          JEditorPane viewer = new JEditorPane();
          viewer.setPreferredSize(new Dimension(500, 600));
          viewer.setText(fillerText);
  
          //Initialize JScrollPane
          JScrollPane scroll = new JScrollPane(viewer);
          scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  
          //Add viewer to the frame
          frame.add(viewer);
  
          //Make frame visible
          frame.pack();
          frame.setVisible(true);
      }
  
  }
  </code></pre>
  
  <p>Why is no scrollbar made visible, and how can I make one visible?</p>