More Tutorials| Bioinformatics| Open Source| Photoshop| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
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.

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

History.addHistoryListener(this)
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.

HyperLinkExample.java

package org.yournamehere.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.HistoryListener;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

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) {
      History.newItem("Banglore");
    }
    VerticalPanel panel = new VerticalPanel();
    panel.add(label);
    panel.add(link0);
    panel.add(link1);
    panel.add(link2);
    panel.add(link3);
    RootPanel.get().add(panel);
    History.addHistoryListener(this);
    History.fireCurrentHistoryState();
  }
  public void onHistoryChanged(String historyToken) {
    label.setText("The current Link selected is: " + historyToken);
  }
}

Main.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module>
  <inherits name="com.google.gwt.user.User"/>
  <entry-point class="org.yournamehere.client.HyperLinkExample"/>
  
</module>

Output of the program

Download sourcecode

                         

» View all related tutorials
Related Tags: c xml file server data gwt vi using this ie example exam e il des trie from in ml m

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.