customize JScrollBar  
Author Message
theodosisx





PostPosted: 2004-8-2 22:39:00 Top

java-programmer, customize JScrollBar Hello,

I want to scroll up/down by pressing buttons
other than the standards of JScrollBar(These
simple up und down arrows).

Is it possible?
 
zoopy





PostPosted: 2004-8-2 23:04:00 Top

java-programmer >> customize JScrollBar On 2-8-2004 16:38, Theodosis Ekizoglos wrote:

> Hello,
>
> I want to scroll up/down by pressing buttons
> other than the standards of JScrollBar(These
> simple up und down arrows).
>
> Is it possible?

Create a button that sets the value of the scroll bar:
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JScrollBar.html#setValue(int)>
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JScrollPane.html#getHorizontalScrollBar()>
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JScrollPane.html#getVerticalScrollBar()>

Some components have methods to scroll to a specific item (e.g. a node in a JTree) or to a specific
Rectangle: see <http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html#otherAPI>

Regards,
Z.