I have created a Link component. My requirement is to write some event listener for the click event. If i click on the link i need to open a different view which may be an another layout component.
For example, i have a login view. In that i have a Link component called “Not Registered”. If i click on the link, i need to open a “New user” view.
How this is possible? Can any one help me on this?
I’ll asume that you know how to open different views and are just stumped with getting a listener attached to a Link component.
If you want to assign click listeners to a link, you are probably looking for the Button component with the Button.STYLE_LINK style. It’s used just like a normal button:
Button myButton = new Button("My very nice link");
myButton.setStyle(Button.STYLE_LINK);
myButton.addListener(new ClickListener() { .... });
If I wanted my link to contain an embedded image, how would I do this, assuming I use the Button with the specified style from above? I want the image to appear on the right hand side of the link.