The demo shows an ExampleVScrollBar and an ExampleHScrollBar whose values are drawn in the draw() method. A Checkbox is also included to show that the min and max values scrollbar values can be reversed to reverse the orientation of the bars. The vertical scroll bar uses the labels option. The horizontal scroll bar uses the hashmark and value options. |
This demo shows how to create a new scrollbar class by extending the Scroller class. Two new classes are created. They are both just 16 lines long. The general process is as follows:
The example has separate constructors for horizontal and vertical scrollbars. It is possible to combine them by adding a parameter for the desired orientation (or otherwise determining the orientation) and using the select_(..., ..., ...) method to supply appropriate values for each case when the values differ. |
The class and sketch code are in the file ExampleScrollBarDemo.pde. | The Scroller code is in the file Dragger.pde |
Revised: 04/11/2014