Reputation: 18521
I have a very long jpanel on a jscrollpane.
I want to be able to jump to a location in the panel. is there a way to jump to a specific point in the pane?
Setting the horizontal scrollbar value is not enough Is there a way to mark a position and jump to it (rather than giving X,Y)? Thanks.
Upvotes: 0
Views: 239
Reputation: 2976
See scrollRectToVisible for scrolling. Not sure what you mean with "mark a position" but if you want to scroll to for example a text field that is a (direct) child of the panel than you would do:
panel.scrollRectToVisible(textField.getBounds());
Upvotes: 3