GWT link button

你说的曾经没有我的故事 提交于 2019-12-22 01:58:37

问题


How to I make a hyperlink that functions as a button? Or how do I make a button that looks like a hyperlink?


回答1:


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");



回答2:


As of GWT 1.5, there is an Anchor widget that should do what you want.




回答3:


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.



来源:https://stackoverflow.com/questions/1076616/gwt-link-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!