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

Last change on this file was 12, checked in by lpino, 18 years ago
  • Initial commit
File size: 1.3 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_04 extends SWTTestCase {
20
21 static {
22 STEP = "009";
23 TEST = "04";
24 DESC = "Combo";
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 Combo");
34 shell.setSize(300, 300);
35 final Combo combo = new Combo(shell, SWT.READ_ONLY);
36 combo.setBounds(50, 50, 150, 65);
37 String[] languages = new String[]{"Java", "C", "C++", "SmallTalk"};
38 combo.setItems(languages);
39 combo.add("Hola", 0);
40 System.out.println(combo.indexOf("C"));
41 shell.open();
42
43 }
44
45
46 void setTitle(String title) {
47 super.setTitle(title);
48 }
49
50 public static void main(String[] args) {
51 go(new SWT009_04());
52 }
53
54}
Note: See TracBrowser for help on using the repository browser.