title: How to create a scrollbar for my JTextArea using JScrollPane?
body: <p>The program compiles properly, but the scroll pane for the text area is not created. I really don't know why this is happening. I defined JscrollPane and even implemented it with scrollPane = new JScrollPane</p>
  
  <p>This is my code:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.awt.event.*;
  import javax.swing.table.*;
  public class GuiProject5 extends JFrame
  {
  private static final int WIDTH = 400;
  private static final int HEIGHT = 300;
  private JPanel lowerPanel;
  private JLabel widthL, areaL;
  private JTextArea areaTA;
  private JTextArea ta;
  private JScrollPane scrollPane;
  private JTextField lengthTF;
  private JCheckBox gergsC;
  private JButton exitB;
  
  //Button handlers:
  private ExitButtonHandler ebHandler;
  
  public GuiProject5()
  {
  
      areaL = new JLabel("Label: ", SwingConstants.RIGHT);
  
      lengthTF = new JTextField("TextField");
  
      lowerPanel = new JPanel();
  
      areaTA = new JTextArea("TextArea", 6, 8);
  
      ta = new JTextArea("stuff", 6, 8);
  
      scrollPane = new JScrollPane();
  
      gergsC = new JCheckBox("Checkbox");
  
      //Specify handlers for each button and add (register)     ActionListeners to each button.
  
      exitB = new JButton("Button");
      ebHandler = new ExitButtonHandler();
      exitB.addActionListener(ebHandler);
  
      setTitle("My Gui in java");
      Container pane = getContentPane();
      pane.setLayout(new GridLayout(4, 2));
  
      //Add things to the pane in the order you want them to appear (left to right, top to bottom)
  
      pane.add(exitB);
      pane.add(lengthTF);
      pane.add(lowerPanel);
      ta = new JTextArea("Stuff", 6, 8);
      ta.setLineWrap(true);
      ta.setWrapStyleWord(true);
      lowerPanel.add(new JScrollPane(scrollPane));
      pane.add(new JScrolscrollpane);
      pane.add(gergsC);
      pane.add(areaL);
  
  
  
      setSize(WIDTH, HEIGHT);
      setVisible(true);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
  
  
  public class ExitButtonHandler implements ActionListener
  {
      public void actionPerformed(ActionEvent e)
      {
          System.exit(0);
      }
  }
  
  public static void main(String[] args)
  {
      GuiProject5 rectObj = new GuiProject5();
  }
  </code></pre>
  
  <p>}</p>