Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Using the SWT INDETERMINATE style

import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; public class ProgressBarExample {   public static void main(String[] args) {     Display display = new Display();     Shell shell = new Shell(display);     shell.setLayout(new GridLayout());     // Create an indeterminate ProgressBar     ProgressBar pb2 = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE);     pb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));     shell.open();     while (!shell.isDisposed()) {       if (!display.readAndDispatch()) {         display.sleep();       }     }   } }