5,692,513 members and growing! (18,840 online)
Email Password   helpLost your password?
Languages » Java » General     Advanced

Tab Control in Java ( in AWT)

By Jeeva S

This is a Java tab Control like SS Tab in VB. Its Cool One
Java, Java, .NET 1.0, NT4, WinXP, Windows, .NET, Dev

Posted: 17 Apr 2002
Updated: 17 Apr 2002
Views: 63,522
Bookmarked: 8 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
15 votes for this Article.
Popularity: 2.05 Rating: 1.74 out of 5
7 votes, 63.6%
1
1 vote, 9.1%
2
0 votes, 0.0%
3
2 votes, 18.2%
4
1 vote, 9.1%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Sample Image - tabcontrol.gif

Introduction

Dear Friends,
        This is one of most wanted component in Java Programming World..  
Here,
  I am using the Card Layout for developing this component. Download the project files and run the run.bat file to get the output.

Explanation

The Following files are used in the Tab Control.
Border.java
BorderPanel.java
Scrollbar.java
    - These Files are Used For crating a Customized Scroll Bar.. 
Scrollpanel.java
   - This is used bar embeding a customized scroll bar into Panel.
TabPanel.java 
  - This is used for creating tabs. That Source Code is as follows

chatClient1.java
  - is Main Applet
Here, This is source for setting Tab Panel

Source Code

import java.awt.Panel;
import java.awt.CardLayout;
import java.awt.BorderLayout;
import java.awt.*;
import java.awt.event.*;
public class TapPanel extends Panel
{
TapPanel(chatClient1 app)
{
	  // Initialize the Components

	  chatclient = app;	
	  // Main Panel

	  RightPanel = new CPanel(300, 500);
	    	    
      Panel panel2 = new Panel();
      CardLayout cardlayout = new CardLayout();
      panel2.setLayout(cardlayout);
      UserPanel = new Panel();	  
      UserPanel.add("Center",new Label("User"));
	  	  	
      ImgScrollPanel = new Panel();
	  ImgScrollPanel.setLayout(new BorderLayout());
	         
      BuddyPanel = new Panel();
	  BuddyPanel.setLayout(new BorderLayout());
	  
	  RoomPanel = new Panel();
	  RoomPanel.setLayout(new BorderLayout());
	  
	  panel2.add("UserPanel", UserPanel);
	  panel2.add("RoomPanel", RoomPanel); 
      panel2.add("ImgScrollPanel", ImgScrollPanel); 
      panel2.add("BuddyPanel", BuddyPanel);

      cardlayout.show(panel2, "UserPanel");

      RightTab = new BorderPanel(this,chatclient, cardlayout, panel2, 210, 270);
	  
      RightTab.addTab("USERS", "UserPanel");
      RightTab.addTab("ROOMS", "RoomPanel"); 
      RightTab.addTab("IMAGES", "ImgScrollPanel");
      RightTab.addTab("BUDDY", "BuddyPanel");
      RightPanel.add(RightTab);
      add(RightPanel);  
}

Panel LeftPanel,BuddyPanel,RoomPanel,ImgScrollPanel,UserPanel;
CPanel RightPanel;
BorderPanel RightTab;
chatClient1 chatclient;
public int i;
}

Finally,

If U want Panel ,You can Add as a Tabs. Finally , in Your Applet or the Main Application, U Just call like tab = new TapPanel(this); then, it will embed it into ur Applet.

Jeeva S

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Jeeva S


i am currently working as a senior software engnieer in dotnet platform (asp.net,c#,sql,vb.net) and i always loves to do think some innovative ideas and will try to implement it using the latest technologies.
Occupation: Web Developer
Location: United Arab Emirates United Arab Emirates

Other popular Java articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 11 of 11 (Total in Forum: 11) (Refresh)FirstPrevNext
GeneralNew in Java [modified]memberaskPrins10:30 17 Jul '08  
GeneralHey!member138256ssn9:03 16 Sep '07  
GeneralRe: Hey!memberaskPrins10:11 17 Jul '08  
General*-- How to GET the SOURCE CODE -- *membertheo2512:35 21 Feb '07  
Generalhave the codingmembercoool_ajit20:44 17 Apr '06  
Generalplz sendmemberashishkumar.er6:59 20 Mar '06  
GeneralThere is an error in your run.bat filesusscode rider20:30 17 Oct '04  
GeneralNo Source files!?memberT.Haberkern1:39 19 Apr '02  
GeneralRe: No Source files!?membertedyoung11:36 2 Dec '03  
Generalhttp://www.codeproject.com/useritems/java_applet_chat_with_gui.aspmemberAltair_Liu19:47 12 Oct '04  
GeneralRe: http://www.codeproject.com/useritems/java_applet_chat_with_gui.aspmemberksnare6:41 29 May '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 17 Apr 2002
Editor:
Copyright 2002 by Jeeva S
Everything else Copyright © CodeProject, 1999-2008
Web17 | Advertise on the Code Project