starcorn
starcorn

Reputation: 8551

How to create clickable link with GWT?

I want to make some clickable links with GWT. I'm not sure if this is the best practice for it. Basically I want something that similar like this if I would've written with html

<a href="index.html" alt="">Link</a>

Upvotes: 6

Views: 14577

Answers (1)

Chris Boesing
Chris Boesing

Reputation: 5279

Use a Hyperlink if you want to "link to some place" in your app (meaning it fires a History change event).
Use an Anchor if you want to link to a site ouside of your app.

Hyperlink link = new Hyperlink("link to foo", "foo"); //text would be "link to foo", would change your url to yourSite.html#foo
Anchor anchor = new Anchor("Link to bar", "www.bar.com"); //text would be "link to bar", would redirect you to "www.bar.com"

Upvotes: 15

Related Questions