Results 1 to 4 of 4
  1. #1
    Java Example is offline Moderator
    Join Date
    Sep 2014
    Posts
    27
    Rep Power
    0

    Default How to create Tab panel using GWT?

    In this tutorial, we will illustrate how to create a Tab panel using GWT. The steps involved in Building the Tab Panel are described below:-

    final Label label = new Label("Click the Tab below to view content")
    Here we are declaring label. Label is a widget that contains text.

    TabPanel tp = new TabPanel()
    Here we are creating object of TabPanel class. TabPanel is a panel that represents a tabbed set of pages, each of which contains another widget.

    HTML index = new HTML("Tab you have selected is Index.")
    Creating an object of class HTML named index. HTML is a widget that can contain arbitrary HTML.

    tp.add(index, "Index ")
    This is a method of Tab Panel class for adding a widget to the tab panel.

    RootPanel.get().add(tp)
    By this method we are adding label to the root panel. Root panel is a panel to which all other widgets must be added.

    Java Code: To create Tab Panel using GWT
    package org.TabPanel.client;
    
    import com.google.gwt.user.client.ui.HTML;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.TabPanel;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class TabPanelEx {
    
        public void onModuleLoad() {
            final Label label = new Label("Click the Tab below to view content");
            final Label label1 = new Label("   ");
    
            TabPanel tp = new TabPanel();
            tp.setWidth("200px");
            HTML index1 = new HTML("");
            HTML index = new HTML("Tab you have selected is Index.");
            tp.add(index, "Index ");
    
            HTML homeText = new HTML("Tab you have selected is Home.");
            tp.add(homeText, " Home  ");
    
            HTML moreInfo = new HTML("Tab you have selected is MoreInfo.");
            tp.add(moreInfo, "  MoreInfo  ");
            tp.selectTab(0);
            RootPanel.get().add(label);
            RootPanel.get().add(label1);
            RootPanel.get().add(tp);
    
        }
    }
    
    Main
    
    .gwt.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <module>
      <inherits name="com.google.gwt.user.User"/>
      <entry-point class  
    
    ="org.TabPanel.client.TabPanelEx"/>
    </module>
    Output of the program

    How to create Tab panel using GWT?-tab.jpg

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: How to create Tab panel using GWT?

    Moved from Java EE -> GWT. Please take the trouble to find and post in the correct section.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Shirin Akter is offline Super Moderator
    Join Date
    Aug 2014
    Location
    Dhaka
    Posts
    1
    Rep Power
    0

    Default Re: How to create Tab panel using GWT?

    It's on the GWT category. The link of the GWT category is GWT Examples

    Thanks.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: How to create Tab panel using GWT?

    Quote Originally Posted by Shirin Akter View Post
    It's on the GWT category. The link of the GWT category is GWT Examples

    Thanks.
    It is now. This isn't where it was posted. Please take the time to read and understand the first sentence of my post at #2 above.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. can't navigate from child panel to main panel
    By sharmapiyush in forum New To Java
    Replies: 76
    Last Post: 04-09-2014, 09:39 PM
  2. how to switch from one panel to another panel
    By sharmapiyush in forum New To Java
    Replies: 2
    Last Post: 04-05-2014, 04:01 PM
  3. panel on a panel not visible
    By warchieflll in forum Advanced Java
    Replies: 2
    Last Post: 01-29-2011, 08:29 PM
  4. Create a rounded rectangle in a panel
    By radhi in forum Java 2D
    Replies: 5
    Last Post: 10-05-2010, 08:58 AM
  5. Add panel to parent panel
    By LovJava in forum AWT / Swing
    Replies: 10
    Last Post: 09-02-2010, 08:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •