Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Creating a JTabbedPane Container in Java Swing 
 

In this section, you will learn how to create the JTabbedPane container in Java Swing.

 

Creating a JTabbedPane Container in Java Swing

                         

In this section, you will learn how to create the JTabbedPane container in Java Swing. The example for illustration is given in which, all the things related to the creation of JTabbedPane container have been illustrated in efficient manner.

This program has used various tools of swing to implement the JTabbed component of Java. The following figure shows the JTabbedPane component of Java Swing:

Swing JTabbed Pane Component

These are explained as follows:

JTabbedPane:
This is the class of javax.swing.*; package which creates the JTabbedPane component of Java Swing which contains separate button for the separate tab. You can also container component with the specific tab.

add():
This is the method of JTabbedPane class which is used to add container component to the JTabbedPane component of Java Swing. This method takes different-different types of arguments but in this program this method has taken two argument, first is the title for the tab and another is the component name which is specified for a particular tab to show for that.

Here is the code of the program:

import javax.swing.*;
import java.awt.*;

public class CreateTabbedPane{
  public static void main(String[] args){
    JFrame frame = new JFrame("Tabbed Pane Frame");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JTabbedPane tab = new JTabbedPane();
    frame.add(tab, BorderLayout.CENTER);
    JButton button = new JButton("1");
    tab.add("Tab 1", button);
    button = new JButton("2");
    tab.add("Tab 2", button);
    frame.setSize(400,400);
    frame.setVisible(true);
  }
}

Download this example.

                         

» View all related tutorials
Related Tags: c class orm form io method sed format 2d get ip translation return rotation instance transform show for transformation to

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 

Current Comments

2 comments so far (
post your own) View All Comments Latest 10 Comments:

add data from database to a ScrollPane in java

Posted by salish on Wednesday, 07.30.08 @ 15:49pm | #69969

why there is not contentPane. you are adding into frame but in swings components are added in contentPane.

Posted by baljit on Friday, 12.8.06 @ 02:52am | #608

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.