title: Scrollbar is not appearing in a JPanel
body: <pre><code>import java.awt.Color;
  import java.awt.Dimension;
  import java.awt.FlowLayout;
  import javax.swing.*;
  import java.awt.Dimension;
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.JScrollPane;
  import javax.swing.border.LineBorder;
  
  class Test
  {
  public Test()
  {
      JFrame f = new JFrame();
      f.setSize(800,800);
      f.setLayout(new FlowLayout());
  
      JPanel s = new JPanel();
      s.setLayout(new BoxLayout(s,BoxLayout.PAGE_AXIS));
  
      JLabel m = new JLabel("D");
      JLabel m1 = new JLabel("D1");
      JLabel m2 = new JLabel("D1");
      JLabel m3 = new JLabel("D1");
      JLabel m4 = new JLabel("D1");
      JLabel m5 = new JLabel("D1");
      JLabel m6 = new JLabel("D1");
      JLabel m7 = new JLabel("D1");
      JLabel m8 = new JLabel("D1");
  
      s.add(m);
      s.add(m1);
      s.add(m2);
      s.add(m3);
      s.add(m4);
      s.add(m5);
      s.add(m6);
      s.add(m7);
      s.add(m8);
  
      JScrollPane scroll = new JScrollPane(s);
  
      //scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
      scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      scroll.setViewportBorder(new LineBorder(Color.RED));
  
      f.add(scroll);
  
      f.setVisible(true);
  }
  
  public static void main(String args[])
  {
      Test t = new Test();
  }
  }
  </code></pre>
  
  <p>Everything is ok,but the Scroll is not showing (JScollPane is appearing) .. and is there a better way to do this ? I mean - the proper way to show a JScrollPane in a panel ...... ?</p>
  
  <p><a href="https://i.stack.imgur.com/73K8d.png" rel="nofollow noreferrer">It's showing like this</a></p>