Is there a way to use the Keyboard to scroll a JScrollPane? I can’t figure out what the JScrollPane scroll methods are so that I can re-define them.
Thanks for any help.
Is there a way to use the Keyboard to scroll a JScrollPane? I can’t figure out what the JScrollPane scroll methods are so that I can re-define them.
Thanks for any help.
add a keylistener to the component that will have focus while you want key scrolling to occur (probably the JScrollPane’s “view” component). On up/down or left/right keypresses, you can alter the Horizontal/Vertical scrollbar positions. There are methods from retrieving the scrollbars in JScrollPane and methods in ScrollBar (I think thats the name of the class) for setting the position.
Thanks for the tip. That is actually what I am trying to do, but the problem is that i can’t figure out how to implement it. I know hod to do set up listeners for the keyboard, but I can’t fiugre out how to manipulate the scrollbar positions.
Is there a way to directly control a JScrollPane? So if you want the pane to automatically show the bottom right is there a way to set the scroll to 80%x and 80%y?