Example usage for com.vaadin.ui Button Button

List of usage examples for com.vaadin.ui Button Button

Introduction

In this page you can find the example usage for com.vaadin.ui Button Button.

Prototype

public Button(Resource icon, ClickListener listener) 

Source Link

Document

Creates a new push button with a click listener.

Usage

From source file:annis.gui.components.ExceptionDialog.java

License:Apache License

public ExceptionDialog(Throwable ex, String caption) {
    this.cause = ex;
    Preconditions.checkNotNull(ex);//w w w  .j  ava2  s. c  om

    layout = new VerticalLayout();
    setContent(layout);
    layout.setWidth("100%");
    layout.setHeight("-1");

    if (caption == null) {
        setCaption("Unexpected error");
    } else {
        setCaption(caption);
    }

    Label lblInfo = new Label("An unexpected error occured.<br />The error message was:", ContentMode.HTML);
    lblInfo.setHeight("-1px");
    lblInfo.setWidth("100%");
    layout.addComponent(lblInfo);
    lblInfo.addStyleName("exception-message-caption");

    String message = ex.getMessage();
    if (message == null || message.isEmpty()) {
        message = "<no message>";
    }
    Label lblMessage = new Label(message);
    lblMessage.addStyleName("exception-message-content");
    lblMessage.setHeight("-1px");
    lblMessage.setWidth("100%");
    layout.addComponent(lblMessage);

    actionsLayout = new HorizontalLayout();
    actionsLayout.addStyleName("exception-dlg-details");
    actionsLayout.setWidth("100%");
    actionsLayout.setHeight("-1px");
    layout.addComponent(actionsLayout);

    btDetails = new Button("Show Details", this);
    btDetails.setStyleName(BaseTheme.BUTTON_LINK);
    actionsLayout.addComponent(btDetails);

    btReportBug = new Button("Report Problem", this);
    btReportBug.setStyleName(BaseTheme.BUTTON_LINK);
    btReportBug.setVisible(false);
    btReportBug.setIcon(FontAwesome.ENVELOPE_O);
    UI ui = UI.getCurrent();
    if (ui instanceof AnnisUI) {
        btReportBug.setVisible(((AnnisUI) ui).canReportBugs());
    }
    actionsLayout.addComponent(btReportBug);
    actionsLayout.setComponentAlignment(btDetails, Alignment.TOP_LEFT);
    actionsLayout.setComponentAlignment(btReportBug, Alignment.TOP_RIGHT);

    lblStacktrace = new Label(Helper.convertExceptionToMessage(ex), ContentMode.PREFORMATTED);
    detailsPanel = new Panel(lblStacktrace);
    detailsPanel.setWidth("100%");
    detailsPanel.setHeight("300px");
    detailsPanel.setVisible(false);
    lblStacktrace.setSizeUndefined();
    lblStacktrace.setVisible(true);
    layout.addComponent(detailsPanel);

    btClose = new Button("OK", this);
    layout.addComponent(btClose);

    layout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER);
    layout.setExpandRatio(detailsPanel, 0.0f);
    layout.setExpandRatio(actionsLayout, 1.0f);
}

From source file:annis.gui.flatquerybuilder.FlatQueryBuilder.java

License:Apache License

private void launch(QueryController cp) {
    this.cp = cp;
    rsc = new ReducingStringComparator();
    this.query = "";
    mainLayout = new VerticalLayout();
    // tracking lists for vertical nodes, edgeboxes and metaboxes
    vnodes = new ArrayList<>();
    eboxes = new ArrayList<>();
    mboxes = new ArrayList<>();
    spbox = null;//from  w  ww. j a  v a  2  s. c om
    // buttons and checks    
    btGo = new Button(BUTTON_GO_LABEL, (Button.ClickListener) this);
    btGo.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btClear = new Button(BUTTON_CLEAR_LABEL, (Button.ClickListener) this);
    btClear.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btInverse = new Button(BUTTON_INV_LABEL, (Button.ClickListener) this);
    btInverse.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btInitLanguage = new Button("Initialize", (Button.ClickListener) this);
    btInitLanguage.setDescription(INFO_INIT_LANG);
    btInitSpan = new Button("Initialize", (Button.ClickListener) this);
    btInitSpan.setDescription(INFO_INIT_SPAN);
    btInitMeta = new Button("Initialize", (Button.ClickListener) this);
    btInitMeta.setDescription(INFO_INIT_META);
    filtering = new NativeSelect("Filtering mechanisms");
    filtering.setDescription(INFO_FILTER);
    ReducingStringComparator rdc = new ReducingStringComparator();
    Set mappings = rdc.getMappings().keySet();
    int i;
    for (i = 0; i < mappings.size(); i++) {
        String mapname = (String) mappings.toArray()[i];
        filtering.addItem(i);
        filtering.setItemCaption(i, mapname);
    }
    filtering.addItem(i + 1);
    filtering.setItemCaption(i + 1, "generic");
    filtering.select(i + 1);
    filtering.setNullSelectionAllowed(false);
    filtering.setImmediate(true);
    // language layout
    language = new HorizontalLayout();
    languagenodes = new HorizontalLayout();
    language.addComponent(languagenodes);
    language.addComponent(btInitLanguage);
    language.setMargin(true);
    language.setCaption(LANG_CAPTION);
    language.addStyleName("linguistics-panel");
    // span layout
    span = new HorizontalLayout();
    span.setSpacing(true);
    span.addComponent(btInitSpan);
    span.setMargin(true);
    span.setCaption(SPAN_CAPTION);
    span.addStyleName("span-panel");
    // meta layout
    meta = new HorizontalLayout();
    meta.setSpacing(true);
    meta.addComponent(btInitMeta);
    meta.setMargin(true);
    meta.setCaption(META_CAPTION);
    meta.addStyleName("meta-panel");
    // toolbar layout
    toolbar = new HorizontalLayout();
    toolbar.setSpacing(true);
    toolbar.addComponent(btGo);
    toolbar.addComponent(btClear);
    toolbar.addComponent(btInverse);
    toolbar.setMargin(true);
    toolbar.setCaption(TOOLBAR_CAPTION);
    toolbar.addStyleName("toolbar-panel");
    // advanced
    advanced = new HorizontalLayout();
    advanced.setSpacing(true);
    advanced.addComponent(filtering);
    advanced.setMargin(true);
    advanced.setCaption(ADVANCED_CAPTION);
    advanced.addStyleName("advanced-panel");
    // put everything on the layout
    mainLayout.setSpacing(true);
    mainLayout.addComponent(language);
    mainLayout.addComponent(span);
    mainLayout.addComponent(meta);
    mainLayout.addComponent(toolbar);
    mainLayout.addComponent(advanced);
    setContent(mainLayout);
    getContent().setWidth("100%");
    getContent().setHeight("-1px");
}

From source file:annis.gui.flatquerybuilder.MetaBox.java

License:Apache License

public MetaBox(String level, FlatQueryBuilder sq) {
    this.sq = sq;
    sb = new VerticalLayout();
    sb.setImmediate(true);/*from   w  w w. ja  va2s . c  om*/
    datum = level;
    // close
    btClose = new Button(SearchBox.BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ChameleonTheme.BUTTON_SMALL);
    // metabox values for ebene
    Collection<String> annonames = new TreeSet<>();
    for (String a : sq.getAvailableMetaLevels(level)) {
        annonames.add(a);
    }
    OptionGroup l = new OptionGroup(level);

    for (String annoname : annonames) {
        if (!annoname.isEmpty()) {
            l.addItem(annoname);
        }
    }

    l.setMultiSelect(true);
    l.setNullSelectionAllowed(true);
    l.addStyleName(Helper.CORPUS_FONT_FORCE);
    l.setImmediate(true);

    tcs = l;
    sb.addComponent(tcs);
    sb.addComponent(btClose);
    setContent(sb);
}

From source file:annis.gui.flatquerybuilder.SearchBox.java

License:Apache License

public SearchBox(final String ebene, final FlatQueryBuilder sq, final VerticalNode vn, boolean isRegex,
        boolean negativeSearch) {
    this.vn = vn;
    this.ebene = ebene;
    this.sq = sq;
    this.vfs = new ArrayList<>();
    vnframe = new VerticalLayout();
    vnframe.setSpacing(true);/*from   w w  w. jav  a2s  .c om*/
    vnframe.setImmediate(true);
    this.sb = new VerticalLayout(); //maybe other name? sb is "reserved" by SearchBox
    sb.setImmediate(true);
    sb.setSpacing(false); //used to be true
    lbl = new Label(ebene);
    HorizontalLayout sbtoolbar = new HorizontalLayout();
    sbtoolbar.setSpacing(false);
    // searchbox tickbox for regex
    reBox = new CheckBox(CAPTION_REBOX);
    reBox.setImmediate(true);
    sbtoolbar.addComponent(reBox);
    reBox.addValueChangeListener(new ValueChangeListener() {
        // TODO make this into a nice subroutine
        @Override
        public void valueChange(ValueChangeEvent event) {
            if (reBox.getValue()) {
                for (ValueField vf : vfs) {
                    String value = vf.getValue();
                    vf.setValueMode(ValueField.ValueMode.REGEX);
                    if (value != null) {
                        vf.setValue(sq.escapeRegexCharacters(value));
                    }
                }
            } else {
                for (ValueField vf : vfs) {
                    String value = vf.getValue();
                    vf.setValueMode(ValueField.ValueMode.NORMAL);
                    if (value != null) {
                        vf.setValue(sq.unescape(value));
                    }
                }
            }
        }
    });
    reBox.setValue(isRegex);
    reBox.setEnabled(true);
    reBoxSingleValue = isRegex;
    // searchbox tickbox for negative search
    negSearchBox = new CheckBox(NEGATIVE_SEARCH_LABEL);
    negSearchBox.setImmediate(true);
    negSearchBox.setValue(negativeSearch);

    sbtoolbar.addComponent(negSearchBox);
    // close the searchbox
    btClose = new Button(BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ValoTheme.BUTTON_SMALL);

    HorizontalLayout titleBar = new HorizontalLayout();
    titleBar.setWidth(vnframe.getWidth(), vnframe.getWidthUnits());
    titleBar.addComponent(lbl);
    titleBar.setComponentAlignment(lbl, Alignment.BOTTOM_LEFT);
    titleBar.addComponent(btClose);
    titleBar.setComponentAlignment(btClose, Alignment.TOP_RIGHT);

    btAdd = new Button(LABEL_BUTTON_ADD);
    btAdd.addClickListener((Button.ClickListener) this);
    btAdd.setStyleName(ValoTheme.BUTTON_SMALL);

    vnframe.addComponent(titleBar);
    vnframe.addComponent(sb);
    vnframe.addComponent(btAdd);
    vnframe.setComponentAlignment(btAdd, Alignment.BOTTOM_RIGHT);
    vnframe.addComponent(sbtoolbar);

    ValueField vf = new ValueField(sq, this, ebene);
    vf.setProtected(true);
    vfs.add(vf);
    sb.addComponent(vf);

    setContent(vnframe);
}

From source file:annis.gui.flatquerybuilder.SpanBox.java

License:Apache License

public SpanBox(final String ebene, final FlatQueryBuilder sq, boolean isRegex) {
    this.ebene = ebene;
    this.sq = sq;
    sb = new HorizontalLayout();
    sb.setImmediate(true);/*from w w  w  .  j a v a2  s. c  om*/
    sb.setSpacing(true);
    sb.setMargin(true);
    ConcurrentSkipListSet<String> annos = new ConcurrentSkipListSet<>();
    for (String a : sq.getAvailableAnnotationLevels(ebene)) {
        annos.add(a);
    }
    this.annonames = annos;
    Label tf = new Label(ebene);
    sb.addComponent(tf);
    this.cb = new SensitiveComboBox();
    cb.setWidth(SB_CB_WIDTH);
    cb.addStyleName(Helper.CORPUS_FONT_FORCE);
    // configure & load content
    cb.setImmediate(true);
    cb.setNewItemsAllowed(true);
    cb.setTextInputAllowed(true);
    for (String annoname : this.annonames) {
        cb.addItem(annoname);
    }
    cb.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_OFF);
    cb.addListener((FieldEvents.TextChangeListener) this);
    sb.addComponent(cb);
    HorizontalLayout sbtoolbar = new HorizontalLayout();
    sbtoolbar.setSpacing(true);
    // searchbox tickbox for regex
    CheckBox tb = new CheckBox("Regex");
    tb.setImmediate(true);
    tb.setValue(isRegex);
    sbtoolbar.addComponent(tb);
    tb.addValueChangeListener(new ValueChangeListener() {
        // TODO make this into a nice subroutine
        @Override
        public void valueChange(ValueChangeEvent event) {
            boolean r = reBox.getValue();
            if (!r) {
                SpanBox.buildBoxValues(cb, ebene, sq);
            } else if (cb.getValue() != null) {
                String escapedItem = sq.escapeRegexCharacters(cb.getValue().toString());
                cb.addItem(escapedItem);
                cb.setValue(escapedItem);
            }
        }
    });
    reBox = tb;
    // close the searchbox
    btClose = new Button(BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ChameleonTheme.BUTTON_SMALL);
    sbtoolbar.addComponent(btClose);
    // make visable
    sb.addComponent(sbtoolbar);
    setContent(sb);
}

From source file:annis.gui.flatquerybuilder.VerticalNode.java

License:Apache License

public VerticalNode(String ebene, String value, FlatQueryBuilder sq, boolean isRegex, boolean negativeSearch) {
    this.sq = sq;
    v = new VerticalLayout();
    v.setSpacing(true);//from w w  w  .j av  a2  s  .  c  om
    vframe = new VerticalLayout();
    vframe.setSpacing(true);
    sboxes = new ArrayList<>();
    btClose = new Button(SearchBox.BUTTON_CLOSE_LABEL, (Button.ClickListener) this);
    btClose.setStyleName(ChameleonTheme.BUTTON_SMALL);
    SearchBox sb = new SearchBox(ebene, sq, this, isRegex, negativeSearch);
    if (value != null) {
        sb.setValue(value);
    }
    sboxes.add(sb);
    annonames = sq.getAvailableAnnotationNames();
    am = new AddMenu(sq, this, ebene);
    vframe.addComponent(btClose);
    vframe.setComponentAlignment(btClose, Alignment.TOP_RIGHT);
    v.addComponent(sb);
    vframe.addComponent(v);
    vframe.addComponent(am);
    vframe.setComponentAlignment(am, Alignment.BOTTOM_RIGHT);
    setWidth(WIDTH);
    setContent(vframe);
}

From source file:annis.gui.ReportBugWindow.java

License:Apache License

public ReportBugWindow(final String bugEMailAddress, final byte[] screenImage, final String imageMimeType,
        Throwable cause) {/*ww  w. ja  v a2  s.  c o  m*/
    this.cause = cause;

    setSizeUndefined();
    setCaption("Report Problem");

    ReportFormLayout layout = new ReportFormLayout();
    setContent(layout);

    layout.setWidth("100%");
    layout.setHeight("-1px");

    setHeight("420px");
    setWidth("750px");

    form = new FieldGroup(new BeanItem<>(new BugReport()));
    form.bindMemberFields(layout);
    form.setBuffered(true);

    final ReportBugWindow finalThis = this;
    btSubmit = new Button("Submit problem report", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                form.commit();

                if (sendBugReport(bugEMailAddress, screenImage, imageMimeType)) {
                    Notification.show("Problem report was sent",
                            "We will answer your problem report as soon as possible",
                            Notification.Type.HUMANIZED_MESSAGE);
                }

                UI.getCurrent().removeWindow(finalThis);

            } catch (FieldGroup.CommitException ex) {
                List<String> errorFields = new LinkedList<>();
                for (Field f : form.getFields()) {
                    if (f instanceof AbstractComponent) {
                        AbstractComponent c = (AbstractComponent) f;
                        if (f.isValid()) {
                            c.setComponentError(null);
                        } else {
                            errorFields.add(f.getCaption());
                            c.setComponentError(new UserError("Validation failed: "));
                        }
                    }
                } // for each field
                String message = "Please check the error messages "
                        + "(place mouse over red triangle) for the following fields:<br />";
                message = message + StringUtils.join(errorFields, ",<br/>");
                Notification notify = new Notification("Validation failed", message,
                        Notification.Type.WARNING_MESSAGE, true);
                notify.show(UI.getCurrent().getPage());
            } catch (Exception ex) {
                log.error("Could not send bug report", ex);
                Notification.show("Could not send bug report", ex.getMessage(),
                        Notification.Type.WARNING_MESSAGE);
            }
        }
    });

    btCancel = new Button("Cancel", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            form.discard();
            UI.getCurrent().removeWindow(finalThis);
        }
    });

    addScreenshotPreview(layout, screenImage, imageMimeType);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addComponent(btSubmit);
    buttons.addComponent(btCancel);

    layout.addComponent(buttons);

}

From source file:annis.gui.ReportBugWindow.java

License:Apache License

private void addScreenshotPreview(Layout layout, final byte[] rawImage, String mimeType) {
    StreamResource res = new StreamResource(new ScreenDumpStreamSource(rawImage),
            "screendump_" + UUID.randomUUID().toString() + ".png");
    res.setMIMEType(mimeType);//from   ww w.j  a v  a 2  s .c om

    final Image imgScreenshot = new Image("Attached screenshot", res);
    imgScreenshot.setAlternateText(
            "Screenshot of the ANNIS browser window, " + "no other window or part of the desktop is captured.");
    imgScreenshot.setVisible(false);
    imgScreenshot.setWidth("100%");

    Button btShowScreenshot = new Button("Show attached screenshot",
            new ShowScreenshotClickListener(imgScreenshot));
    btShowScreenshot.addStyleName(BaseTheme.BUTTON_LINK);
    btShowScreenshot.setIcon(FontAwesome.PLUS_SQUARE_O);

    layout.addComponent(btShowScreenshot);
    layout.addComponent(imgScreenshot);
}

From source file:at.jku.ce.adaptivetesting.vaadin.ui.core.VaadinUI.java

License:LGPL

public VaadinUI() {
    // Set up the Navigator
    navigator = new Navigator(this, this);

    // Create Welcome Screen
    MainUI mainScreen = new MainUI();
    mainScreen.setMargin(true);//from   ww  w  . j  a v  a 2s.c o m
    Button start = new Button("Start", e -> {
        navigator.navigateTo(Views.TEST.toString());
    });
    start.setWidth("40%");
    start.setHeight("40%");
    //mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Willkommen zur " + productData)));
    mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h2", "Bitte klicke den <b>" + start.getCaption()
            + "</b> Button um mit dem Rechnungswesentest zu beginnen!")));
    mainScreen.addComponent(start);
    mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER);

    navigator.addView(Views.DEFAULT.toString(), mainScreen);
    // Question view
    // Change this to the questionManager you like
    final QuestionManager manager = new AccountingQuestionManager("Rechnungswesentest");
    navigator.addView(Views.TEST.toString(), manager);
    navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName())));
    navigator.addView(Views.Admin.toString(), new AdminView(manager));
    navigator.addView(Views.Results.toString(), new ResultView(manager));
    navigator.setErrorView(mainScreen);
    LogHelper.logInfo("Startup completed");
}

From source file:at.jku.ce.adaptivetesting.vaadin.ui.topic.accounting.AccountingQuestionManager.java

License:LGPL

@Override
public void startQuiz(StudentData student) {
    // Remove everything from the layout, save it for displaying after
    // clicking OK
    final Component[] components = new Component[getComponentCount()];
    for (int i = 0; i < components.length; i++) {
        components[i] = getComponent(i);
    }//  w w  w  .jav  a 2  s  .  co m
    removeAllComponents();
    // Create first page
    VerticalLayout layout = new VerticalLayout();
    addComponent(layout);

    ComboBox gender = new ComboBox("Geschlecht");
    String[] genderItems = { "mnnlich", "weiblich" };
    gender.addItems(genderItems);
    //gender.setSizeFull();
    gender.setEnabled(true);

    Label gradeLastYear = new Label("<p/>Welche Note hattest du im letzten Zeugnis in ...", ContentMode.HTML);
    TextField gradeLastYearRW = new TextField("Rechungswesen");
    TextField gradeLastYearBWL = new TextField("BWL/BVW");
    TextField gradeLastYearD = new TextField("Deutsch");
    TextField gradeLastYearE = new TextField("Englisch");
    TextField gradeLastYearM = new TextField("Mathematik");

    Label gradeLastTest = new Label("<p/>Welche Note hattest du auf die letzte Schularbeit aus ...",
            ContentMode.HTML);
    TextField gradeLastTestRW = new TextField("Rechungswesen");
    TextField gradeLastTestBWL = new TextField("BWL/BVW");
    TextField gradeLastTestD = new TextField("Deutsch");
    TextField gradeLastTestE = new TextField("Englisch");
    TextField gradeLastTestM = new TextField("Mathematik");

    Label classNameLabel = new Label("<p/>Welche Klasse besuchst du?", ContentMode.HTML);
    TextField className = new TextField("(z.B. 4A)");

    Label studentCode = new Label(
            "<p/>Damit deine Antworten mit spteren Fragebogenergebnissen verknpft werden knnen, ist es notwendig, einen anonymen Benutzernamen anzulegen. Erstelle deinen persnlichen Code nach folgendem Muster:",
            ContentMode.HTML);
    TextField studentCodeC1 = new TextField(
            "Tag und Monat der Geburt (DDMM), z.B. \"1008\" fr Geburtstag am 10. August");
    TextField studentCodeC2 = new TextField(
            "Zwei Anfangsbuchstaben des Vornamens, z.B. \"St\" fr \"Stefan\"");
    TextField studentCodeC3 = new TextField(
            "Zwei Anfangsbuchstaben des Vornamens der Mutter,, z.B. \"Jo\" fr \"Johanna\"");

    Label thankYou = new Label("<p/>Danke fr die Angaben.<p/>", ContentMode.HTML);
    Button cont = new Button("Weiter", e -> {
        removeAllComponents();
        studentIDCode = new String(
                studentCodeC1.getValue() + studentCodeC2.getValue() + studentCodeC3.getValue());
        studentGender = (gender.getValue() == null) ? new String("undefined") : gender.getValue().toString();
        studentClass = className.getValue();

        studentGradesLastYear = new HashMap();
        studentGradesLastYear.put("RW", gradeLastYearRW.getValue());
        studentGradesLastYear.put("BWL", gradeLastYearBWL.getValue());
        studentGradesLastYear.put("D", gradeLastYearD.getValue());
        studentGradesLastYear.put("E", gradeLastYearE.getValue());
        studentGradesLastYear.put("M", gradeLastYearM.getValue());

        studentGradesLastTest = new HashMap();
        studentGradesLastTest.put("RW", gradeLastTestRW.getValue());
        studentGradesLastTest.put("BWL", gradeLastTestBWL.getValue());
        studentGradesLastTest.put("D", gradeLastTestD.getValue());
        studentGradesLastTest.put("E", gradeLastTestE.getValue());
        studentGradesLastTest.put("M", gradeLastTestM.getValue());

        this.student = new StudentData(studentIDCode, studentGender, studentClass, studentGradesLastYear,
                studentGradesLastTest);
        LogHelper.logInfo("StudentData: " + this.student.toString());

        displayCompanyInfo(components);
    });

    layout.addComponent(HtmlLabel.getCenteredLabel("h1", "Fragen zu deiner Person"));// Title of the quiz

    layout.addComponent(gender);

    layout.addComponent(gradeLastYear);
    layout.addComponent(gradeLastYearRW);
    layout.addComponent(gradeLastYearBWL);
    layout.addComponent(gradeLastYearD);
    layout.addComponent(gradeLastYearE);
    layout.addComponent(gradeLastYearM);

    layout.addComponent(gradeLastTest);
    layout.addComponent(gradeLastTestRW);
    layout.addComponent(gradeLastTestBWL);
    layout.addComponent(gradeLastTestD);
    layout.addComponent(gradeLastTestE);
    layout.addComponent(gradeLastTestM);

    layout.addComponent(classNameLabel);
    layout.addComponent(className);

    layout.addComponent(studentCode);
    layout.addComponent(studentCodeC1);
    layout.addComponent(studentCodeC2);
    layout.addComponent(studentCodeC3);

    layout.addComponent(thankYou);
    layout.addComponent(cont);
    layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER);
}