public static void main(String[] args) {
	    Display display = new Display();
	    Shell shell = new Shell(display);
	    Tree tree = new Tree(shell, SWT.BORDER | SWT.CHECK);
	    tree.addListener(SWT.Selection, new Listener() {
	        @Override
			public void handleEvent(Event event) {
	            if (event.detail == SWT.CHECK) {
	                TreeItem item = (TreeItem) event.item;
	                boolean checked = item.getChecked();
	                checkItems(item, checked);
	                checkPath(item.getParentItem(), checked, false);
	            }
	        }
	    });
	    for (int i = 0; i < 4; i++) {
	        TreeItem itemI = new TreeItem(tree, SWT.NONE);
	        itemI.setText("Item " + i);
	        for (int j = 0; j < 4; j++) {
	            TreeItem itemJ = new TreeItem(itemI, SWT.NONE);
	            itemJ.setText("Item " + i + " " + j);
	            for (int k = 0; k < 4; k++) {
	                TreeItem itemK = new TreeItem(itemJ, SWT.NONE);
	                itemK.setText("Item " + i + " " + j + " " + k);
	            }
	        }
	    }
		Rectangle clientArea = shell.getClientArea();
	    tree.setBounds(clientArea.x, clientArea.y, 200, 200);
	    shell.pack();
	    shell.open();
	    while (!shell.isDisposed()) {
	        if (!display.readAndDispatch()) display.sleep();
	    }
	    display.dispose();
	}