Reputation: 5610
How to I make a hyperlink that functions as a button? Or how do I make a button that looks like a hyperlink?
Upvotes: 15
Views: 17316
Reputation: 3011
As of GWT 1.5, there is an Anchor widget that should do what you want.
Upvotes: 15
Reputation: 11
I also found you can use the anchor class. add a click event and load the method you want as a new page. Inside the page clear the root or other panels you want using the clear() method eg. Rootpanel.get("root panel name").clear();
I wrote the example up and gave an example if you want to check it out. Hope this helps.
Upvotes: 0
Reputation: 45101
One easy way is to use the Label class. Just create a new label and add a ClickHandler to it. You can then style it however you want using CSS:
Label lbl = new Label("Hello");
lbl.addClickHandler(...);
lbl.setStyleName("hyperlink_style_label");
Upvotes: 13