code: public void setupPanel()
      {
          this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
          this.addGridHeading();
  
          JPanel panel = new JPanel();
          panel.setOpaque(false);
          panel.setMinimumSize(new Dimension(20, 20));
          panel.setLayout(new BorderLayout());
          JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          panel.add(scrollPane);
          this.add(panel);
          m_panelGrid = new JPanel();
          JPanel panelAligner = new JPanel(); // This panel keeps the panelgrid in the upper left hand of the scrollpane.
          panelAligner.add(m_panelGrid);
          panelAligner.setLayout(new FlowLayout(FlowLayout.LEADING));
          scrollPane.getViewport().add(panelAligner);
          panelAligner.setOpaque(false);
          m_panelGrid.setOpaque(false);
          scrollPane.getViewport().setOpaque(false);
          scrollPane.setOpaque(false);
  
          this.addGridDetail();
      }
docs: Setup a new panel.