hi i want to add Scroll Pane to JTable

JScrollPane jScrollPane = new JScrollPane(table);
    jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    add(jScrollPane,BorderLayout.CENTER);

in the above code table is and Object of JTable with default model
i write above code but that code display the scrollbar but they dont work

i solved that thread

by using

table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);