I use this statement to assign a scrollPane to a Jtable. However when I add the scrollPane to any other JPanel. The height of the scrollPane is much larger than the table height.
JPanel tablepane=new JPanel();
tableau= new JTable();
tableau.setModel(model);
tableC=new JScrollPane();
tableC.setViewportView(tableau);