コード例 #1
0
  @Override
  protected void setup(VaadinRequest request) {
    htmlWindow = new Window("", new Label("HTML caption"));
    htmlWindow.setId("htmlWindow");
    htmlWindow.setCaptionAsHtml(true);
    htmlWindow.setPositionX(300);
    htmlWindow.setPositionY(200);

    textWindow = new Window("", new Label("Text caption"));
    textWindow.setId("textWindow");
    textWindow.setCaptionAsHtml(false);
    textWindow.setPositionX(300);
    textWindow.setPositionY(400);

    addWindow(htmlWindow);
    addWindow(textWindow);

    Button red =
        new Button(
            "Red",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption("<font style='color: red;'>This may or may not be red</font>");
              }
            });
    Button plainText =
        new Button(
            "Plain text",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption("This is just text");
              }
            });
    Button nullCaption =
        new Button(
            "Null",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption(null);
              }
            });
    Button empty =
        new Button(
            "Empty",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption("");
              }
            });

    addComponents(red, plainText, nullCaption, empty);
    red.click();
  }
コード例 #2
0
  @Override
  protected void setup(VaadinRequest request) {

    Window w = new Window();
    w.setId(WINDOW_ID);
    w.setWidth("300px");
    w.setHeight("300px");
    w.center();

    VerticalLayout content = new VerticalLayout();
    w.setContent(content);
    content.setHeight("1000px");
    ComboBox<String> cb = new ComboBox<>();
    cb.setId(COMBOBOX_ID);
    content.addComponent(cb);
    content.setComponentAlignment(cb, Alignment.BOTTOM_CENTER);

    addWindow(w);
  }