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

Last change on this file was 252, checked in by lpino, 16 years ago
  • Tree basic testcase
  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/*
2 * SWT009_11.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.layout.GridLayout;
18import org.eclipse.swt.layout.GridData;
19import org.eclipse.swt.graphics.*;
20
21public class SWT009_11 extends SWTTestCase {
22
23 static {
24 STEP = "011";
25 TEST = "09";
26 DESC = "Tree";
27 }
28
29 Shell createTopShell(Display display) {
30 return new Shell(display, SWT.SHELL_TRIM | SWT.NO_REDRAW_RESIZE);
31 }
32
33
34 void initComponents() {
35 Tree tree;
36 shell.setLayout(new GridLayout());
37
38 tree = new Tree(shell, SWT.BORDER);
39
40 tree.setLayoutData(new GridData(GridData.FILL_BOTH));
41
42 TreeItem item = new TreeItem(tree, SWT.NULL);
43 item.setText("ITEM");
44
45 TreeItem item2 = new TreeItem(item, SWT.NULL);
46 item2.setText("ITEM2");
47
48 TreeItem item3 = new TreeItem(item2, SWT.NULL);
49 item3.setText("ITEM3");
50
51 System.out.println("item: " + item.getParent() + ", " + item.getParentItem());
52 System.out.println("item2: " + item2.getParent() + ", " + item2.getParentItem());
53
54 System.out.println(tree.getItemCount());
55 System.out.println(tree.getItems().length);
56
57 shell.setSize(300, 200);
58 shell.open();
59
60 }
61
62
63 void setTitle(String title) {
64 super.setTitle(title);
65 }
66
67 public static void main(String[] args) {
68 go(new SWT009_11());
69 }
70
71}
Note: See TracBrowser for help on using the repository browser.