Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > change the scroll speed of a scroll pane?

Reply
Thread Tools

change the scroll speed of a scroll pane?

 
 
Kevin
Guest
Posts: n/a
 
      02-05-2005
One question about JScrollPane:

we can use:
jScrollPane.getHorizontalScrollBar().setUnitIncrem ent(60);
jScrollPane.getHorizontalScrollBar().setBlockIncre ment(180);
to set how much space/pixel to scroll when user click on the scroll
bar.

However, how about if the user presses the arrow keys on the keyboard
instead of using the mouse??? I find in that way, the scroll pane
scrolls very slowly. How to set its speed (amount of pixel to scroll)
for the scroll event from keyword arrow keys?

Thanks a lot.

 
Reply With Quote
 
 
 
 
Roland
Guest
Posts: n/a
 
      02-05-2005
On 5-2-2005 4:57, Kevin wrote:

> One question about JScrollPane:
>
> we can use:
> jScrollPane.getHorizontalScrollBar().setUnitIncrem ent(60);
> jScrollPane.getHorizontalScrollBar().setBlockIncre ment(180);
> to set how much space/pixel to scroll when user click on the scroll
> bar.
>
> However, how about if the user presses the arrow keys on the keyboard
> instead of using the mouse??? I find in that way, the scroll pane
> scrolls very slowly. How to set its speed (amount of pixel to scroll)
> for the scroll event from keyword arrow keys?
>
> Thanks a lot.
>

Which component do you have inside the scrollpane? If this component
implements javax.swing.Scrollable you can control the block and unit
increments (getScrollableUnitIncrement(Rectangle,int,int)).
A number of components already implement this interface, so have a look
at the source of getScrollableUnitIncrement in JList, JTable, JTree or
JTextComponent, for instance.
HTH,
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable Scroll up and scroll down in CR-report Sathiamoorthy ASP .Net 1 11-28-2006 11:42 PM
Listbox disabled - cant scroll in IE - can scroll in Firefox =?Utf-8?B?Ui5OaWprYW1w?= ASP .Net 0 11-22-2006 03:46 PM
Using a div with scroll bars - can we get the scroll bars on the left instead of the right side? UJ ASP .Net 1 11-01-2006 09:32 PM
prevent mouse scroll to scroll in a dropdownlist nicholas ASP .Net 0 12-07-2004 11:26 AM
speed speed speed a.metselaar Computer Support 14 12-30-2003 03:34 AM



Advertisments