don't use
scrollPane.add(table);
use
scrollPane.setViewportView(table)
instead, which is same as
scrollPane.getViewport().add(table)
u can add things to JScrollPane, but it's its viewport that's displayed.
//-----------
import javax.swing.*;
public class AdminTab //extends JPanel //implements ActionListener
{
public static void main(
String[] args) {
JScrollPane scrollPane = new JScrollPane();
JFrame frame = new JFrame();
frame.add(scrollPane);
*OK scrollPane.setViewportView(new JLabel("haha"));
*NO scrollPane.add(new JLabel("haha"));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 300);
frame.setVisible(true);
}
}
//-----------------------