Methods for java create sliding scale bar

Asked By 20 points N/A Posted on -
qa-featured

I used java creates sliding scale bar in creating my application that controls the animation speed.

What methods can i use to create a new object of type scale?

SHARE
Answered By 75 points N/A #139883

Methods for java create sliding scale bar

qa-featured

Gloriawburbage,

Thank you for your inquiry, I will provide you with the code to create a scroll bar, both vertically and horizontally, in Java using SWT.  

In this example your class will be "Scrolling on Thursday" and we will import a package named "org.whistles.swt.widgets" which will create a scroll bar in Java. Looking at this example it is going to print 10 times "Whistles can be fun and Loud". 

The scroll to accomplish this is:

import org.whistles.swt.SWT;
import org.whistles.swt.layout.*;
import org.whistles.swt.widgets.*;

public class ScrollingOnThursday {
  public static void main(String[] args) {
  Display display = new Display();
  Shell shell = new Shell(display);
  shell.setLayout(new FillLayout());
  
  List list = new List(shell,SWT.V_SCROLL|SWT.H_SCROLL);
  for (int i = 0; i < 10; i++) {
  list.add("Whistles can be fun and Loud");
  }
  shell.setText("Show Scrollbar");
  shell.open();
  shell.setSize(200,150);
  while (!shell.isDisposed()) {
  if (!display.readAndDispatch()) {
  display.sleep();
  }
  }
  display.dispose();
  }

Related Questions