This section is all about creating scroll bar in Java SWT
The given example will show you how to create scroll bar in Java using SWT, for that we have created a class with the name ScrollBarExamle that imports a package org.eclipse.swt.widgets, which is used to create ScrollBar in Java. Further in this example, we have create a list by using the class List. A string is added to the list by using the method list.add(). We have create a for loop to print the specified string 20 times.
The styles SWT.V_SCROLL, SWT.H_SCROLL provided by the class ScrollBar creates the vertical and horizontal bars.
Here is the code of ScrollBarExample.java
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: October 4, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles