Click here to Skip to main content
6,916,824 members and growing! (15,566 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, .NET1.0, WinXP, Dev
Posted:17 Apr 2002
Views:78,482
Bookmarked:13 times
Unedited contribution
printPrint Friendly   add Share
      Discuss Discuss   Broken Article?Report  
16 votes for this article.
Popularity: 2.21 Rating: 1.83 out of 5
7 votes, 58.3%
1
1 vote, 8.3%
2

3
3 votes, 25.0%
4
1 vote, 8.3%
5

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


Member
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
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 12 of 12 (Total in Forum: 12) (Refresh)FirstPrevNext
GeneralCode java of Chat program Pinmemberthopt8:51 3 Nov '09  
GeneralNew in Java [modified] PinmemberaskPrins10:30 17 Jul '08  
GeneralHey! Pinmember138256ssn9:03 16 Sep '07  
GeneralRe: Hey! PinmemberaskPrins10:11 17 Jul '08  
General*-- How to GET the SOURCE CODE -- * Pinmembertheo2512:35 21 Feb '07  
Generalhave the coding Pinmembercoool_ajit20:44 17 Apr '06  
Generalplz send Pinmemberashishkumar.er6:59 20 Mar '06  
GeneralThere is an error in your run.bat file Pinsusscode rider20:30 17 Oct '04  
GeneralNo Source files!? PinmemberT.Haberkern1:39 19 Apr '02  
GeneralRe: No Source files!? Pinmembertedyoung11:36 2 Dec '03  
Generalhttp://www.codeproject.com/useritems/java_applet_chat_with_gui.asp PinmemberAltair_Liu19:47 12 Oct '04  
GeneralRe: http://www.codeproject.com/useritems/java_applet_chat_with_gui.asp Pinmemberksnare6:41 29 May '08  

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.

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