Reputation: 511
I've JScrollPane with table inside it.
scroll = new JScrollPane(table);
scroll.setBorder(BorderFactory.createLineBorder(Color.black));
add(scroll);
I want to disable it, but
scroll.setEnabled(false);
does nothing.
Is there a way to disable scroll pane?
Upvotes: 0
Views: 1464
Reputation: 9946
JScrollPane.setEnabled(false)
does not work as suggested, it is a bug, in order to get the same behavior you need to do the following:
scroll.getHorizontalScrollBar().setEnabled(false);
scroll.getVerticalScrollBar().setEnabled(false);
scroll.getViewport().getView().setEnabled(false);
Hope this helps.
Upvotes: 2