title: Scroll Bar not working in Java
body: <p>I am writing a program in Java, but for some reason the scroll bar in my bottom most component isn't working. I have no idea why. It should apply a vertical scroll bar to the bottom text area. What am I doing wrong?</p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import javax.swing.*;
  import javax.swing.Timer;
  import java.text.*;
  import java.lang.*;
  import java.util.*;
  
  
  
  public class TimerGui extends JFrame
  {
  private static final int FRAME_HEIGHT = 300;
  private static final int FRAME_WIDTH = 600;
  
  private JPanel topPanel;
  private JPanel leftPanel;
  private JPanel bottomPanel;
  
  private JLabel topLabel;
  private JLabel leftLabel;
  
  private JTextField setTimer;
  private JTextArea displayTimer;
  
  private JScrollPane scrollPane;
  
  private JButton startButton;
  
  //no-arg constructor
  public TimerGui()
  {
      createTopPanel();
      createLeftPanel();
      createBottomPanel();
      setSize(FRAME_WIDTH, FRAME_HEIGHT);
  }
  
  //creates the top panel, including the label and text field 
  private void createTopPanel()
  {
      topPanel = new JPanel();
      topLabel = new JLabel("TIMER LAB:");
  
      final int FIELD_WIDTH = 10;
      setTimer = new JTextField(FIELD_WIDTH);
  
      topPanel.add(topLabel);
      topPanel.add(setTimer);
  
      add(topPanel, BorderLayout.NORTH);
  }
  
  //creates the left panel, which is just a single text label
  private void createLeftPanel()
  {
      leftPanel = new JPanel();
      leftLabel = new JLabel("(1000 milliseconds = 1 second)");
  
      add(leftPanel, BorderLayout.WEST);
  
      leftPanel.add(leftLabel);
  }
  
  
  //the listener for the start button
  class ClickListener implements ActionListener
  {
      public void actionPerformed(ActionEvent event)
      {
          int speed = Integer.parseInt(setTimer.getText());
  
          MyListner listener = new MyListner();
          Timer timer = new Timer(speed, listener);
          timer.start(); 
      }
  }
  
  class MyListner implements ActionListener
  {
      public void actionPerformed(ActionEvent event)
      {         
          SimpleDateFormat simpleTime = new SimpleDateFormat("HH:mm:ss.SSS");
          Date now = new Date();
          String time = simpleTime.format(now);
          displayTimer.append(time + String.format("%n"));
      }
  }
  
  //creates the button, with action listener attached
  private void createStartButton()
  {
      startButton = new JButton("Start");
  
      ActionListener listener = new ClickListener();
      startButton.addActionListener(listener);
  }
  
  //creates the bottom panel, with the start button and the display text field
  private void createBottomPanel()
  {
      final int FIELD_WIDTH = 10;
  
      bottomPanel = new JPanel();
      displayTimer = new JTextArea(10, 15);
      displayTimer.setEditable(false);
      scrollPane = new JScrollPane(displayTimer);
         scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  
      add(bottomPanel, BorderLayout.SOUTH);
  
      createStartButton();
      bottomPanel.add(startButton);
      bottomPanel.add(displayTimer);
      bottomPanel.add(scrollPane);
  }
  
  }
  </code></pre>