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

Last change on this file was 12, checked in by lpino, 18 years ago
  • Initial commit
File size: 2.5 KB
Line 
1/*
2 * SWT009_04.java
3 */
4
5/*
6 * Copyright (c) 2002, 2005 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_05 extends SWTTestCase {
20
21 static {
22 STEP = "009";
23 TEST = "05";
24 DESC = "Slider";
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 shell.setText("Hello World Slider");
34 shell.setSize(300, 300);
35 Slider slider = new Slider(shell, SWT.HORIZONTAL);
36 slider.setBounds(10, 10, 200, 32);
37 slider.addListener(SWT.Selection, new Listener() {
38 public void handleEvent(Event event) {
39 String string = "SWT.NONE";
40 switch (event.detail) {
41 case SWT.DRAG:
42 string = "SWT.DRAG";
43 break;
44 case SWT.HOME:
45 string = "SWT.HOME";
46 break;
47 case SWT.END:
48 string = "SWT.END";
49 break;
50 case SWT.ARROW_DOWN:
51 string = "SWT.ARROW_DOWN";
52 break;
53 case SWT.ARROW_UP:
54 string = "SWT.ARROW_UP";
55 break;
56 case SWT.PAGE_DOWN:
57 string = "SWT.PAGE_DOWN";
58 break;
59 case SWT.PAGE_UP:
60 string = "SWT.PAGE_UP";
61 break;
62 }
63 System.out.println("Scroll detail -> " + string);
64 }
65 });
66
67// final Combo combo = new Combo(shell, SWT.READ_ONLY);
68// combo.setBounds(50, 50, 150, 65);
69// String[] languages = new String[]{"Java", "C", "C++", "SmallTalk"};
70// combo.setItems(languages);
71// combo.add("Hola", 0);
72// System.out.println(combo.indexOf("C"));
73 shell.open();
74
75 }
76
77
78 void setTitle(String title) {
79 super.setTitle(title);
80 }
81
82 public static void main(String[] args) {
83 go(new SWT009_05());
84 }
85
86}
Note: See TracBrowser for help on using the repository browser.