Example usage for com.google.gwt.user.client.ui Label Label

List of usage examples for com.google.gwt.user.client.ui Label Label

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Label Label.

Prototype

protected Label(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:asquare.gwt.tests.focusevent.client.Demo.java

License:Apache License

private Widget createDemoPanel() {
    TestPanel outer = new TestPanel();

    outer.add(new Label("GWT onfocus Event Handler"));
    outer.add(new Button("Button"), "Button");
    outer.add(new CheckBox("CheckBox"), "CheckBox");
    outer.add(new RadioButton("group1", "RadioButton1"), "RadioButton1");
    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    outer.add(textBox, "TextBox");
    PasswordTextBox passwordTextBox = new PasswordTextBox();
    passwordTextBox.setText("PasswordTextBox");
    outer.add(passwordTextBox, "PasswordTextBox");
    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    outer.add(textArea, "TextArea");
    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("item2");
    listBox.addItem("item3");
    outer.add(listBox, "ListBox");
    outer.add(new FocusPanel(new Label("Label in a FocusPanel")), "FocusPanel");
    Tree tree = new Tree();
    tree.addItem("item1");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree, "Tree");

    return outer;
}

From source file:asquare.gwt.tests.selecttreeitem.client.Demo.java

License:Apache License

public void onModuleLoad() {
    Debug.enableSilently();/*from w w  w. j ava 2s .  com*/

    TreeItem treeRoot = new TreeItem("Tree");
    final TreeItem treeItem = new TreeItem("foo");
    treeRoot.addItem(treeItem);
    treeRoot.addItem("bar");
    treeRoot.addItem("baz");
    final Tree tree = new Tree();
    tree.addItem(treeRoot);
    //        DeferredCommand.addCommand(new Command()
    //        {
    //            public void execute()
    //            {
    tree.setSelectedItem(treeItem);
    tree.ensureSelectedItemVisible();
    //            }
    //        });
    //        
    RootPanel.get().add(tree);

    // this is not reached in Opera
    RootPanel.get().add(new Label("Entry point was sucessfully executed"));
}

From source file:asquare.gwt.tk.client.ui.AlertDialog.java

License:Apache License

/**
 * Set the message which will be displayed in the dialog. 
 * /*from   w  w  w.jav  a2 s .c o m*/
 * @param text a String, or <code>null</code>
 * @param asHtml true to treat <code>captionText</code> as HTML, false to
 *            treat <code>captionText</code> as plain text
 */
public void setMessage(String text, boolean asHtml) {
    if (text == null) {
        setMessage((Widget) null);
    } else {
        if (asHtml) {
            setMessage(new HTML(text));
        } else {
            setMessage(new Label(text));
        }
    }
}

From source file:asquare.gwt.tk.uitest.alertdialog.client.Demo.java

License:Apache License

public void onModuleLoad() {
    Debug.enable();/*from  w w w  .  j a va2 s  .  co m*/

    new DebugEventListener('x', Event.ONMOUSEDOWN, null) {
        @Override
        protected void doEvent(Event event) {
            Element target = DOM.eventGetTarget(event);
            Debug.println("target=" + DebugUtil.prettyPrintElement(target));
            int screenX = DOM.eventGetScreenX(event);
            int screenY = DOM.eventGetScreenY(event);
            int clientX = DOM.eventGetClientX(event);
            int clientY = DOM.eventGetClientY(event);
            int absLeft = DOM.getAbsoluteLeft(target);
            int absTop = DOM.getAbsoluteTop(target);
            int offsetLeft = getOffsetLeft(target);
            int offsetTop = getOffsetTop(target);
            int docScrollX = Window.getScrollLeft();
            int docScrollY = Window.getScrollTop();
            Debug.println("screenX=" + screenX + ",screenY=" + screenY + ",clientX=" + clientX + ",clientY="
                    + clientY + ",absLeft=" + absLeft + ",absTop=" + absTop + ",offsetLeft=" + offsetLeft
                    + ",offsetTop=" + offsetTop + ",docScrollX=" + docScrollX + ",docScrollY=" + docScrollY);
        }
    }.install();
    new DebugEventListener('z', Event.ONMOUSEDOWN, "Offset hierarchy inspector") {
        @Override
        protected void doEvent(Event event) {
            Element target = DOM.eventGetTarget(event);
            printOffsetTopHierarchy(target);
        }
    }.install();

    new DebugHierarchyInspector().install();

    new DebugElementDumpInspector().install();

    new DebugEventListener(Event.ONMOUSEDOWN | Event.ONMOUSEUP).install();

    if (!GWT.isScript()) {
        DebugConsole.getInstance().disable();
    }

    final Button button = new Button();
    button.setText("Default Info dialog");
    button.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final AlertDialog alert = AlertDialog.createInfo(new Command() {
                public void execute() {
                    Debug.println("OK clicked");
                }
            }, "Info Dialog", "this is a default info dialog");
            alert.show();
        }
    });
    RootPanel.get().add(button);

    Command showDialog = new Command() {
        private AlertDialog m_dialog;

        public void execute() {
            if (m_dialog == null) {
                m_dialog = AlertDialog.createWarning(this, "Caption text", null);
                ScrollPanel message = new ScrollPanel();
                message.setAlwaysShowScrollBars(true);
                message.setWidth("100%");
                message.setHeight("100px");
                message.setWidget(new Label(
                        "These packages contain reference information about the main GWT user interface and utility classes. For higher-level explanations of how to take advantage of all this stuff, check out the Developer Guide. Among other things, there's a handy widget gallery and an explanation of how remote procedure calls work.These packages contain reference information about the main GWT user interface and utility classes. For higher-level explanations of how to take advantage of all this stuff, check out the Developer Guide. Among other things, there's a handy widget gallery and an explanation of how remote procedure calls work."));
                m_dialog.setMessage(message);
                m_dialog.setSize("400px", "300px");
                m_dialog.addController(new ControllerAdaptor(Controller.class, Event.ONMOUSEDOWN) {
                    @Override
                    public void onBrowserEvent(Widget widget, Event event) {
                        int x = DomUtil.eventGetAbsoluteX(event) - DOM.getAbsoluteLeft(widget.getElement());
                        int y = DomUtil.eventGetAbsoluteY(event) - DOM.getAbsoluteTop(widget.getElement());
                        Debug.println("onMouseDown(" + x + "," + y + ")");
                    }
                });
            }
            m_dialog.show();
        }
    };
    showDialog.execute();
}

From source file:asquare.gwt.tk.uitest.isvisible.client.Demo.java

License:Apache License

public void onModuleLoad() {
    RootPanel outer = RootPanel.get();//from www.  j av  a2s  .c om

    TextBox rowInput = new TextBox();
    TextBox colInput = new TextBox();
    Grid input = new Grid(2, 2);
    input.setText(0, 0, "Row: ");
    input.setWidget(0, 1, rowInput);
    input.setText(1, 0, "Col: ");
    input.setWidget(1, 1, colInput);
    outer.add(input);

    final int ROWS = 20;
    final int COLS = 20;
    Grid grid = new Grid(ROWS, COLS);
    grid.setCellPadding(0);
    grid.setCellSpacing(0);
    for (int row = 0; row < ROWS; row++) {
        for (int col = 0; col < COLS; col++) {
            grid.setWidget(row, col, new Label("(" + row + "," + col + ")"));
        }
    }

    ScrollPanel scrollInner = new ScrollPanel();
    scrollInner.setAlwaysShowScrollBars(true);
    scrollInner.setPixelSize(400, 400);
    scrollInner.setWidget(grid);
    ScrollPanel scrollOuter = new ScrollPanel();
    scrollOuter.add(scrollInner);
    scrollOuter.setAlwaysShowScrollBars(true);
    scrollOuter.setPixelSize(600, 200);
    outer.add(scrollOuter);
    scrollInner.setScrollPosition(100);
    scrollInner.setHorizontalScrollPosition(100);
}

From source file:asquare.gwt.tk.uitest.popuppanel.client.ToolTipRendererString.java

License:Apache License

public void render(CWindow toolTip, ToolTipModel model) {
    toolTip.setWidget(new Label((String) ((HasToolTip) model.getToolTipWidget()).getToolTipContent()));
}

From source file:asquare.gwt.tkdemo.client.Demo.java

License:Apache License

public void onModuleLoad() {
    Debug.enableSilently();//from  w ww . j a v  a  2 s.  co  m

    final AppPanelCollection panels = new DemoPanelCollection();

    String initialTabToken = History.getToken();
    int initialIndex = panels.getIndexForToken(initialTabToken);
    if (initialIndex == -1) {
        initialIndex = 0;
    }

    // use a table for border to work around bugs with 100% child width
    RowPanel outer = new RowPanel();
    DomUtil.setAttribute(outer, "id", "main");
    outer.setWidth("100%");

    ExposedCellPanel tabPanel = new ColumnPanel();
    tabPanel.setSize("100%", "100%");

    CTabBar tabbar = new CTabBar(new ListWidgetVTable(), new SideTabRenderer3());
    tabbar.removeController(tabbar.getController(CompositeCellViewHoverController.class));
    tabbar.setStyleName("DemoTabBar");
    History.addValueChangeHandler(new TabModelUpdateController(panels, tabbar.getListModel()));
    tabPanel.add(tabbar);
    tabPanel.setCellStyleName("DemoTabPanel-tabBar");

    tabPanel.add(new HTML("<h2 style='text-align: center; width: 100%; height: 100%;'>Loading...</h2>"));
    tabPanel.setCellStyleName("DemoTabPanel-tabBody");
    tabPanel.setCellWidth("100%");
    new TabBodyUpdateController(tabbar.getListModel(), tabPanel, panels);

    outer.add(tabPanel);
    RootPanel.get().add(outer);

    BrowserInfo browserInfo = (BrowserInfo) GWT.create(BrowserInfo.class);
    String compatMode = describeCompatMode();
    Label env = new Label(compatMode + " (" + browserInfo.getUserAgent() + ")");
    env.setStyleName("compatMode");
    outer.add(env);

    new DebugElementDumpInspector().install();

    /**
    * Incrementally add tabs to TabBar, allowing the UI to redraw to show
    * progress.
    */
    DeferredCommand.addCommand(new LoadUICommand(panels, tabbar, initialIndex));
}

From source file:asquare.gwt.tkdemo.client.demos.DialogPanel.java

License:Apache License

private Widget createModalDialogDemo() {
    BasicPanel panel = new BasicPanel("div", "block");
    panel.setStyleName("example division");
    DomUtil.setStyleAttribute(panel, "whiteSpace", "nowrap");

    panel.add(new HTML("<h4>ModalDialog examples</h4>"));

    class CloseListener implements ClickHandler {
        private final ModalDialog m_dialog;

        public CloseListener(ModalDialog dialog) {
            m_dialog = dialog;/*w  ww .  java2 s . c o m*/
        }

        public void onClick(ClickEvent event) {
            m_dialog.hide();
        }
    }

    class CloseButton extends Button {
        public CloseButton(ModalDialog dialog) {
            super("Close");
            addClickHandler(new CloseListener(dialog));
        }

        public CloseButton(ModalDialog dialog, String text) {
            super(text);
            addClickHandler(new CloseListener(dialog));
        }
    }

    final Button plainDialog = new Button("Plain");
    plainDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            dialog.setCaption("Caption area", false);
            dialog.add(new Label("Content area"));
            dialog.add(new CloseButton(dialog));
            dialog.show(plainDialog);
        }
    });
    panel.add(plainDialog);

    final Button verboseDialog = new Button("Verbose");
    verboseDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            dialog.setCaption("Verbose dialog", false);
            dialog.add(new Label("Twas brillig, and the slithy toves " + "  Did gyre and gimble in the wabe: "
                    + "All mimsy were the borogoves, " + "  And the mome raths outgrabe "
                    + "Beware the Jabberwock, my son! " + "The jaws that bite, the claws that catch! "
                    + "Beware the Jubjub bird, and shun " + "The frumious Bandersnatch!"));
            dialog.add(new CloseButton(dialog));
            dialog.show(verboseDialog);
        }
    });
    panel.add(verboseDialog);

    final Button captionLessDialog = new Button("No caption");
    captionLessDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            dialog.add(new Label("Captionless dialog"));
            dialog.add(new CloseButton(dialog));
            dialog.show(captionLessDialog);
        }
    });
    panel.add(captionLessDialog);

    final Button loadingDialog = new Button("Loading...");
    loadingDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            final Label label = new Label("0% loaded");
            dialog.add(label);
            dialog.show(loadingDialog);
            new Timer() {
                private int m_count = 0;

                public void run() {
                    label.setText(++m_count + "% loaded");
                    if (m_count == 100) {
                        dialog.hide();
                        cancel();
                    }
                }
            }.scheduleRepeating(1);
        }
    });
    panel.add(loadingDialog);

    final Button undraggableDialog = new Button("Drag disabled");
    undraggableDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog() {
                protected List<Controller> createCaptionControllers() {
                    List<Controller> result = new ArrayList<Controller>();
                    result.add(ControlSurfaceController.getInstance());
                    return result;
                }
            };
            dialog.setCaption("Drag disabled", false);
            dialog.add(new Label(
                    "This dialog uses a custom controller in the header which does not provide drag support."));
            dialog.add(new CloseButton(dialog));
            dialog.show(undraggableDialog);
        }
    });
    panel.add(undraggableDialog);

    final Button styledDragDialog = new Button("Drag style");
    styledDragDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            String oldPrimaryName = dialog.getStylePrimaryName();
            dialog.setStylePrimaryName("dialog-dragstyle");
            dialog.addStyleName(oldPrimaryName);
            dialog.setCaption("Drag me", false);
            dialog.add(new Label(
                    "This dialog employs the \"tk-ModalDialog-dragging\" style which is applied while dragging. "));
            dialog.add(new CloseButton(dialog));
            dialog.show(styledDragDialog);
        }
    });
    panel.add(styledDragDialog);

    final Button focusManagementDialog = new Button("Focus management");
    focusManagementDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            dialog.setCaption("Register", false);
            FocusModel fModel = dialog.getFocusModel();

            final int FIELD_COUNT = 3;
            Grid table = new Grid(FIELD_COUNT, 2);
            dialog.add(table);
            Widget[] labels = new Widget[FIELD_COUNT];
            labels[0] = new Label("User name: ");
            labels[1] = new Label("Password: ");
            labels[2] = new Label("Retype password: ");

            FocusWidget[] fields = new FocusWidget[FIELD_COUNT];
            fields[0] = new TextBox();
            fields[1] = new PasswordTextBox();
            fields[2] = new PasswordTextBox();

            CellFormatter formatter = table.getCellFormatter();
            for (int i = 0; i < labels.length; i++) {
                table.setWidget(i, 0, labels[i]);
                formatter.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT);
                table.setWidget(i, 1, fields[i]);

                /*
                 * Manually add fields to focus cycle. (The dialog does not
                 * scan the children of panels for focusable widgets.)
                 */
                fModel.add(fields[i]);
            }

            // this widget will be focused when the dialog is shown
            fModel.setFocusWidget(fields[0]);

            ColumnPanel buttonPanel = new ColumnPanel();
            buttonPanel.setWidth("100%");
            dialog.add(buttonPanel);

            Button closeButton = new CloseButton(dialog, "Register!");
            fModel.add(closeButton);
            buttonPanel.add(closeButton);

            Button cancelButton = new CloseButton(dialog, "Cancel");
            fModel.add(cancelButton);
            buttonPanel.addWidget(cancelButton, false);
            buttonPanel.setCellHorizontalAlignment(ColumnPanel.ALIGN_RIGHT);

            dialog.show(focusManagementDialog);
        }
    });
    panel.add(focusManagementDialog);

    final Button explicitlyPositionedDialog = new Button("Explicitly positioned");
    explicitlyPositionedDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            dialog.removeController(dialog.getController(ModalDialog.PositionDialogController.class));
            int contentWidth = 300;
            int contentHeight = 100;
            dialog.setContentWidth(contentWidth + "px");
            dialog.setContentHeight(contentHeight + "px");
            dialog.setPopupPosition(100, 100);
            dialog.setCaption("Explicitly positioned dialog", false);
            dialog.add(new Label(
                    "Automatic positioning is disabled. Dimensions and position are set explicitly. "));
            dialog.add(new CloseButton(dialog));
            dialog.show(explicitlyPositionedDialog);
        }
    });
    panel.add(explicitlyPositionedDialog);

    final Button multipleDialogs = new Button("Multiple dialogs");
    multipleDialogs.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            ModalDialog dialog = new ModalDialog();
            dialog.setCaption("First dialog", false);
            FocusModel fModel = dialog.getFocusModel();
            RowPanel outer = new RowPanel();

            dialog.add(new HTML(""));

            final UrlLocation urlBox = new UrlLocation();
            urlBox.setText("http://www.asquare.net");
            urlBox.setWidth("350px");
            fModel.add(urlBox);
            outer.add(urlBox);

            Button goButton = new Button("Go");
            fModel.add(goButton);
            fModel.setFocusWidget(goButton);
            outer.addWidget(goButton, false);

            ListBox addressList = new ListBox();
            addressList.addItem("Select an address");
            addressList.addItem("http://www.asquare.net");
            addressList.addItem("http://www.google.com");
            addressList.addItem("http://www.sourceforge.net");
            addressList.addItem("http://www.apache.org");
            fModel.add(addressList);
            outer.add(addressList);

            final Frame frame = new Frame();
            frame.setSize("400px", "200px");
            outer.add(frame);
            urlBox.addChangeHandler(new ChangeHandler() {
                public void onChange(ChangeEvent event) {
                    frame.setUrl(urlBox.getURL());
                }
            });
            goButton.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    frame.setUrl(urlBox.getURL());
                }
            });
            addressList.addChangeHandler(new ChangeHandler() {
                public void onChange(ChangeEvent event) {
                    ListBox list = (ListBox) event.getSource();
                    if (list.getSelectedIndex() > 0) {
                        urlBox.setText(list.getItemText(list.getSelectedIndex()));
                        frame.setUrl(list.getItemText(list.getSelectedIndex()));
                    }
                }
            });
            final Button secondDialog = new Button("Show second dialog");
            secondDialog.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    final ModalDialog dialog = new ModalDialog();
                    dialog.setCaption("Second dialog", false);
                    dialog.add(new Label("Note that you cannot manipulate the widgets in the first dialog. "));
                    dialog.add(new CloseButton(dialog));
                    dialog.show(secondDialog);
                }
            });
            fModel.add(secondDialog);
            outer.add(secondDialog);
            Button closeButton = new CloseButton(dialog);
            fModel.add(closeButton);
            outer.add(closeButton);
            dialog.add(outer);
            dialog.show(multipleDialogs);
        }
    });
    panel.add(multipleDialogs);

    final Button styledDialog = new Button("Styled");
    styledDialog.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final ModalDialog dialog = new ModalDialog();
            dialog.addStyleName("dialog-styled");
            HorizontalPanel caption = new HorizontalPanel();
            caption.setWidth("100%");
            Label captionText = new Label("Oopsie!");
            caption.add(captionText);
            caption.setCellWidth(captionText, "100%");
            Image close = new Image("close.gif");
            close.addClickHandler(new CloseListener(dialog));
            caption.add(close);
            dialog.setCaption(caption);
            dialog.add(new Label("I've been a bad, bad browser."));
            dialog.add(new Button("Deny ice cream", new CloseListener(dialog)));
            dialog.show(styledDialog);
        }
    });
    panel.add(styledDialog);

    return panel;
}

From source file:asquare.gwt.tkdemo.client.demos.ExposedCellPanelPanel.java

License:Apache License

public ExposedCellPanelPanel() {
    DomUtil.setId(this, "rowPanelPanel");
    setSize("100%", "100%");

    String text = "<h2>RowPanel, ColumnPanel</h2>"
            + "<p>Flexible replacements for VerticalPanel &amp; HorizontalPanel</p>"
            + "<ul><li>Allow multiple widgets in each table cell</li>" + "<li>Exposes TD to CSS</li>"
            + "<li>Simplifies layout by eliminating need for a nested container (e.g. the DIV in TabBar tabs)</li>"
            + "<li>Random access to rows and widgets</li>" + "</ul>";
    HTMLPanel description = new HTMLPanel(text);
    description.setStyleName("description division");
    add(description);/*  w  w  w .  j  av  a2  s .  c o m*/

    ColumnPanel examples = new ColumnPanel();
    add(examples);

    BasicPanel ex1 = new BasicPanel();
    ex1.setStyleName("example division");
    examples.add(ex1);

    ex1.add(new Label("RowPanel"));

    RowPanel rp1 = new RowPanel();
    DomUtil.setId(rp1, "ex1");
    rp1.setSpacing(2);
    ex1.add(rp1);

    rp1.addCell();
    rp1.addCellStyleName("ex1-caption");
    Label label1 = new Label("Cell 1");
    label1.setWidth("100%");
    label1.setHeight("100%");
    rp1.addWidget(label1, false);

    rp1.addCell();
    rp1.addCellStyleName("ex1-content");
    Label label2 = new Label("Cell 2");
    rp1.addWidget(label2, false);

    rp1.addWidget(new Button("Button"), false);

    BasicPanel ex2 = new BasicPanel();
    ex2.setStyleName("example division");
    examples.add(ex2);

    ex2.add(new Label("ColumnPanel"));

    ColumnPanel cp1 = new ColumnPanel();
    DomUtil.setId(cp1, "ex1");
    cp1.setSpacing(2);
    ex2.add(cp1);

    cp1.addCell();
    cp1.addCellStyleName("ex1-caption");
    Label label3 = new Label("Cell 1");
    label3.setWidth("100%");
    label3.setHeight("100%");
    cp1.addWidget(label3, false);

    cp1.addCell();
    cp1.addCellStyleName("ex1-content");
    Label label4 = new Label("Cell 2");
    cp1.addWidget(label4, false);

    cp1.addWidget(new Button("Button"), false);
}

From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java

License:Apache License

private Widget createFocusCycle1() {
    FocusCyclePanel cycle1 = new FocusCyclePanel("div", "block");

    cycle1.add(new Label("Cycle 1"));

    cycle1.add(new FocusStyleDecorator(new Button("Button")));

    Button buttonDisabled = new Button("disabled");
    buttonDisabled.setEnabled(false);/*from  w  ww. j a  va 2s .c o m*/
    cycle1.add(new FocusStyleDecorator(buttonDisabled));

    Button buttonNegativeTabIndex = new Button("tabIndex = -1");
    buttonNegativeTabIndex.setTabIndex(-1);
    cycle1.add(new FocusStyleDecorator(buttonNegativeTabIndex));

    cycle1.add(new FocusStyleDecorator(new CheckBox("CheckBox")));

    cycle1.add(new FocusStyleDecorator(new FocusPanel(new Label("FocusPanel"))));

    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("Item 1");
    listBox.addItem("Item 2");
    listBox.addItem("Item 3");
    cycle1.add(new FocusStyleDecorator(listBox));

    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    cycle1.add(new FocusStyleDecorator(textBox));

    PasswordTextBox pwBox = new PasswordTextBox();
    pwBox.setText("PasswordTextBox");
    cycle1.add(new FocusStyleDecorator(pwBox));

    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    cycle1.add(new FocusStyleDecorator(textArea));

    Tree tree = new Tree();
    TreeItem treeRoot = new TreeItem("Tree");
    for (int branchNum = 1; branchNum < 4; branchNum++) {
        TreeItem branch = new TreeItem("Branch " + branchNum);
        for (int item = 1; item < 4; item++) {
            branch.addItem("Item " + item);
        }
        treeRoot.addItem(branch);
    }
    tree.addItem(treeRoot);
    cycle1.add(new FocusStyleDecorator(tree));

    new WidgetFocusStyleController(cycle1.getFocusModel());

    return cycle1;
}