Changeset 264 for trunk/tests


Ignore:
Timestamp:
Nov 10, 2010, 3:46:45 PM (15 years ago)
Author:
lpino
Message:
  • New tescase for progressbar class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/SWT/java/SWT009_10.java

    r259 r264  
    44
    55/*
    6  * Copyright (c) 2002, 2007 EclipseOS2 Team.
     6 * Copyright (c) 2002, 2010 EclipseOS2 Team.
    77 * This file is made available under the terms of the Common Public License v1.0
    88 * which accompanies this distribution, and is available at
     
    3131
    3232        void initComponents() {
    33             final ProgressBar pb = new ProgressBar(shell, SWT.HORIZONTAL);
    34 //            pb.setMinimum(0);
    35 //            pb.setMaximum(100);
    36 //            pb.setSelection(50);
    37 //            pb.setBounds(10, 10, 200, 20);
    38             shell.pack();
    39             shell.open();
    40 
     33            final ProgressBar bar =new ProgressBar(shell,SWT.HORIZONTAL);
     34            bar.setBounds(0, 0, 200, 20);
     35            shell.pack();
     36            shell.open();
     37            final int maximum = bar.getMaximum();
     38                new Thread() {
     39                public void run() {
     40                    for (int i = 1; i <= maximum; i++) {
     41                        try {
     42                            Thread.sleep(100);
     43                        } catch (Throwable th) {
     44                        }
     45                        final int index = i;
     46                        display.asyncExec(new Runnable() {
     47                            public void run() {
     48                                bar.setSelection(index);
     49                            }
     50                        });
     51                    }
     52                }
     53                }.start();
    4154        }
    42 
    43 
    4455        void setTitle(String title) {
    4556                super.setTitle(title);
Note: See TracChangeset for help on using the changeset viewer.