public void display() throws Exception {
    /*
     * Create the display and shell.
     */
    display = new Display();
    final Shell shell = new Shell(display);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.verticalSpacing = 3;
    shell.setLayout(layout);
    /*
     * Create a toolbar
     */
    {
      ToolBar toolbar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT | SWT.NO_FOCUS);
      toolbar.setForeground(display.getSystemColor(SWT.COLOR_RED));
      toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
      ToolItem item = new ToolItem(toolbar, SWT.PUSH);
      item.setText("File");
      item = new ToolItem(toolbar, SWT.PUSH);
      item.setText("Edit");
      item = new ToolItem(toolbar, SWT.PUSH);
      item.setText("Help");
    }

    if (styleSheetStream == null) {
      // Create Styles themes
      createThemesStyleComposite(shell);
    }

    /*
     * Create a sash form.
     */
    SashForm form = new SashForm(shell, SWT.NONE);
    form.setLayoutData(new GridData(GridData.FILL_BOTH));
    /*
     * Create the buddylist tree.
     */
    {
      tree = new Tree(form, SWT.SINGLE);
      tree.addSelectionListener(
          new SelectionListener() {
            public void widgetDefaultSelected(SelectionEvent e) {
              if (((TreeItem) e.item).getParentItem() != null) {
                try {
                  createChatControl(e.item);
                } catch (Exception ex) {
                  ex.printStackTrace();
                }
              }
            }

            public void widgetSelected(SelectionEvent e) {}
          });
      for (int i = 0; i < GROUPS.length; i++) {
        String g = GROUPS[i];
        TreeItem parentItem = new TreeItem(tree, SWT.NONE);
        parentItem.setText(g);
        for (int j = 0; j < NAMES.length; j++) {
          String n = NAMES[j];
          TreeItem item = new TreeItem(parentItem, SWT.NONE);
          item.setText(n);
        }
        parentItem.setExpanded(true);
      }
    }
    /*
     * Add the tabfolder
     */
    {
      tabFolder = new CTabFolder(form, SWT.CLOSE);
      tabFolder.setUnselectedCloseVisible(true);
      tabFolder.setUnselectedImageVisible(true);
      form.setWeights(new int[] {30, 70});
      // open a couple chats
      createChatControl(tree.getItem(0).getItems()[0]);
      createChatControl(tree.getItem(0).getItems()[1]);
      tabFolder.setSelection(tabFolder.getItem(0));
    }
    /*
     * Create a statusbar
     */
    {
      CLabel statusbar = new CLabel(shell, SWT.NONE);
      GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
      statusbar.setLayoutData(gd);
      statusbar.setText("Samantha Daryn is online");
    }
    /*
     * StyleHelper is used to parse and apply styles.
     */
    engine = getCSSEngine();
    if (styleSheetStream != null) {
      engine.parseStyleSheet(styleSheetStream);
      engine.applyStyles(shell, true);
    }
    /*
     * Now we open the shell.
     */
    shell.setSize(new Point(600, 600));
    shell.open();
    shell.setText("CSS Instant Messaging");
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }