title: Scroll Bars For Multiple JTextPanes (Java)
body: <p>Attached is my window code:</p>
  
  <pre><code>import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.ScrollPaneConstants;
  import java.awt.BorderLayout;
  import javax.swing.JTextPane;
  public class Window extends JFrame{
      private JPanel panel;
      private JTextPane textPane;
      private JTextPane textPane_1;   
      public Window() {
          super("Window");
          this.init();
          this.setSize(800, 600);
          this.setVisible(true);
      }
      void init(){
          panel = new JPanel();
          getContentPane().add(panel, BorderLayout.CENTER);
          panel.setLayout(null);      
          textPane = new JTextPane();
          textPane.setBounds(6, 48, 788, 185);
          panel.add(textPane);
          textPane.setFocusable(true);        
          textPane_1 = new JTextPane();
          textPane_1.setBounds(6, 346, 788, 185);
          panel.add(textPane_1);      
          JScrollPane scroll1 = new JScrollPane(textPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          scroll1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
          scroll1.setViewportView(textPane);
          panel.add(scroll1);
          this.add(scroll1);      
          JScrollPane scroll2 = new JScrollPane(textPane_1, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          scroll2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
          scroll2.setViewportView(textPane);
          panel.add(scroll2);
          this.add(scroll2);      
          this.add(panel);
      }
  }
  </code></pre>
  
  <p>My objective is for both JTextPanes to have their own scroll bars.  All that appears on the screen though is a single JTextPane (not sure which one), and it has only a vertical scroll bar (I think this is because JTextPanes have word wrap).  The second JTextPane isn't showing up.  Can anyone help me?</p>
  
  <p>Thanks in advance to all who reply.</p>