Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Tutorials Gwt Creating Hyperlink using GWT

Related Tutorials


Share on Google+Share on Google+

Creating Hyperlink using GWT

This example describes the Basics for building the Hyperlink using GWT.

Creating Hyperlink using GWT


This example describes the Basics for building the Hyperlink using GWT. The steps involved in Building the Hyperlink are described below:-

private Label label = new Label()
Here we are declaring label. Label is a widget that contains text.

Hyperlink link0 = new Hyperlink("Delhi", "Delhi")
Creating Hyperlink object named 'link0'. Hyperlink is a class or a widget that serves as an "internal" hyperlink

VerticalPanel panel = new VerticalPanel()
Creating Vertical panel. Vertical panel  is a class that lays all of its widgets out in a single vertical column.

This is the method of  class Vertical panel. By using this method we added a label to the Panel

History is a class that allows us to interact with the browser's history stack. addHistoryListener() is a method of this class to adds a listener to the browser's history stack.

package org.yournamehere.client;

public class HyperLinkExample implements EntryPoint,HistoryListener {
  private Label label = new Label();
 public void onModuleLoad() {
  Hyperlink link0 = new Hyperlink("Delhi""Delhi");
  Hyperlink link1 = new Hyperlink("Mumbai""Mumbai");
  Hyperlink link2 = new Hyperlink("Chennai""Chennai");
  Hyperlink link3 = new Hyperlink("Banglore""Banglore");

  String Token = History.getToken();
  if (Token.length() == 0) {
  VerticalPanel panel = new VerticalPanel();
  public void onHistoryChanged(String historyToken) {
  label.setText("The current Link selected is: " + historyToken);


<?xml version="1.0" encoding="UTF-8"?>
  <inherits name=""/>
  <entry-point class="org.yournamehere.client.HyperLinkExample"/>

Output of the program

Download sourcecode



If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 8, 2008

Related Tutorials

Discuss: Creating Hyperlink using GWT   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image