title: How To Have A TabPane For A ScrollPane With A TextPane in Java
body: <p>I'm creating a notepad program in Java and would like to have different tabs to for each document opened. I'm having trouble getting the tabs to be displayed. This is my test document so far that I have looked over here at first and I modified it for the text document. <a href="https://stackoverflow.com/questions/15930621/how-to-add-a-jscrollpane-onto-a-jtabbedpane-using-a-null-layout">How to add a JScrollPane onto a JTabbedPane using a null layout?</a>.</p>
  
  <p>This is what I currently have:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class Test extends JFrame {
  
      private static void CreateAndShowGui() {
  
          JFrame frame = new JFrame("Program");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          JTextPane txt = new JTextPane();
          JPanel noWrapPanel = new JPanel(new BorderLayout());
          noWrapPanel.add(txt);
  
          JScrollPane scroll = new JScrollPane(noWrapPanel);
  
          JPanel topPanel = new JPanel();
          topPanel.setLayout(new BorderLayout());
  
          frame.add(topPanel);
  
          JPanel panel = new JPanel();
          panel.setLayout(new BorderLayout());
          panel.add(scroll, BorderLayout.CENTER);
  
          JTabbedPane tabbedPane = new JTabbedPane();
          tabbedPane.addTab("Welcome", panel);
          topPanel.add(tabbedPane);
  
          frame.add(scroll);
  
          frame.setSize(400, 200);
          frame.setVisible(true);
  
      }
  
      public static void main(String[] args) {
  
          SwingUtilities.invokeLater(new Runnable() {
  
              public void run() {
  
                  UIManager.put("swing.boldmetal", Boolean.FALSE);
                  CreateAndShowGui();
  
              }
  
          });
  
      }
  
  }
  </code></pre>
  
  <p>What am I doing wrong? :(</p>