Add even on Button made on Composite UI

I am very much new with Vaadin. I have made buttons on Composite UI and now I want to call another compositeUI (loginUI) on the button click. What should I do and where should I write the click event. I tried but failed. Below are my code

public class Logon extends CustomComponent {
private AbsoluteLayout mainLayout;

private Label welcome;

private HorizontalLayout horizontalLayout_2;

private Button registerButton;

private Button loginButton;

/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
final static Logger logger = Logger.getLogger(Logon.class);

 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 * The constructor will not be automatically regenerated by the
 * visual editor.
public Logon() {
    // TODO add user code here;
    LoginUI loginUI = new LoginUI();

private AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    // top-level component properties
    // horizontalLayout_2
    horizontalLayout_2 = buildHorizontalLayout_2();
    mainLayout.addComponent(horizontalLayout_2, "top:90.0px;right:348.0px;bottom:334.0px;left:120.0px;");
    // welcome
    welcome = new Label();
    welcome.setCaption("Welcome to Strike4Cash");
    welcome.setValue("Earn cash in simple click");
    mainLayout.addComponent(welcome, "top:60.0px;bottom:374.0px;left:431.0px;");
    return mainLayout;

private HorizontalLayout buildHorizontalLayout_2() {
    // common part: create layout
    horizontalLayout_2 = new HorizontalLayout();
    // loginButton
    loginButton = new Button();
    horizontalLayout_2.setExpandRatio(loginButton, 1.0f);
    // registerButton
    registerButton = new Button();
    horizontalLayout_2.setExpandRatio(registerButton, 1.0f);
    return horizontalLayout_2;


Are you using the old and deprecated Visual Designer with Eclipse? I strongly recommend Vaadin Designer instead (commercial product).

Anyways using Navigator is a good way to implement navigation. In your UI class init method.

@Override protected void init(VaadinRequest vaadinRequest) { // .... Navigator navigator = new Navigator(this, this); navigator.addView("someview", SomeView.class); navigator.addView("anotherview", AnotherView.class); setNavigator(navigator); if ("".equals(navigator.getState())) { navigator.navigateTo("someview"); } } Using navigator requires your views to implement com.navigator.View interface.

Yes I am using old deprecated Visual Designer, I have applied for Student Key but no one ever replied to me.

Did you try to use Navigator?

Sorry to hear no one answered your application. The instructions for non-commercial license key applications has been clarified to explain that due to high amount of requests, applications must be done by the teacher / faculty member.

I copied the latest instructions from /pro-tools and they are the following

  • Application email must be sent from the official domain provided by the institute
  • Application for an educational institute needs to be done by an employee of the institute (not students). If you are a student, you should ask a professor or an employee at the educational institute to request the licenses
  • Please provide a brief description of the project

Hi Hayry,

I have tried using the Navigtor from all the resource I got on internet but not helping me yet. Below attched are 3 java files.
TestAppUI is Main Class which Calls Logon Composite UI when application run. On click of button inside I want to open LoginUI which is another Composite UI. You can see I have added some code. But not working .

For second part:
I am actually not a student. I am a Java Developer working with IBM in India, I have encounter Vaadin 3 days ago and I find it quite useful and very efficient. So I have decided myself to learn it and work only only on Vaadin. (nothing to do with IBM). But I cannot pay that much amount for yearly. It is too high for me. That is the reason I am trying to learn from the resources I got for Free fro you guys. (3.52 KB) (991 Bytes) (1.04 KB)

Well if at first Navigator seems too difficult to use, you can always call

        loginButton.addClickListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                UI.getCurrent().setContent(new LoginUI());

Wow, This was easy but haven’t found on Google. Problem Solved. Thanks for the Help Hayry… As I said I am new to Vaadin. I might will disturb you all Pros. :slight_smile:

It was great help!