I added the following code to my project in order to get JScrollPane to automatically lower to the bottom after user performance selection, however, when I tried to drag the scroll to go to the beginning, it still had to do a scroll down to the end, and I want to ask any solution to solve it? Thanks in advance.
private void autoScrollToBottom() {
sdPanel.getTabScrollPane().getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
e.getAdjustable().setValue(e.getAdjustable().getMaximum());
}
});
}
source
share