|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
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
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.
ExplanationThe 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 AppletHere, This is source for setting Tab Panel Source Codeimport 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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||