Creating a scale in SWT

Main.java:

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
 
public class Main {
   public static void main (String [] args) {
      Display display = new Display ();
      Shell shell = new Shell (display);
   
      shell.setBounds(200, 200, 250, 250);   
       
      final Scale scale = new Scale (shell, SWT.VERTICAL);
      scale.setMinimum(100);
      scale.setMaximum(200);
      scale.setBounds(10, 10, 30, 200);
      final StyledText styledText = new StyledText(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
      styledText.setBounds(50, 10, 180, 200);
       
      scale.addListener(SWT.Selection, new Listener () {
         public void handleEvent(Event event) {
            styledText.append(scale.getSelection() + "n");
            int offset = styledText.getOffsetAtLine(styledText.getLineCount()-1);
            styledText.setCaretOffset(offset);
            styledText.showSelection();
         }
      });
 
      shell.open ();
      while (!shell.isDisposed()) {
         if (!display.readAndDispatch ()) display.sleep ();
      }
   }
}