source: trunk/tests/SWT/java/SWT009_10.java

Last change on this file was 264, checked in by lpino, 15 years ago
  • New tescase for progressbar class
  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1/*
2 * SWT009_10.java
3 */
4
5/*
6 * Copyright (c) 2002, 2010 EclipseOS2 Team.
7 * This file is made available under the terms of the Common Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/cpl-v10.html
10 */
11
12import org.eclipse.swt.widgets.Display;
13import org.eclipse.swt.widgets.Shell;
14import org.eclipse.swt.SWT;
15import org.eclipse.swt.widgets.*;
16import org.eclipse.swt.layout.FillLayout;
17import org.eclipse.swt.graphics.*;
18
19public class SWT009_10 extends SWTTestCase {
20
21 static {
22 STEP = "009";
23 TEST = "10";
24 DESC = "ProgressBar";
25 }
26
27 Shell createTopShell(Display display) {
28 return new Shell(display, SWT.SHELL_TRIM | SWT.NO_REDRAW_RESIZE);
29 }
30
31
32 void initComponents() {
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();
54 }
55 void setTitle(String title) {
56 super.setTitle(title);
57 }
58
59 public static void main(String[] args) {
60 go(new SWT009_10());
61 }
62
63}
Note: See TracBrowser for help on using the repository browser.