String : Tabded Pane

Java has class javax.swing.JTabbedPane that is used to represent the tabbed pane. Tabbed pane is a container that has the more than one Panel attached with the tabbed name, where you can place the components. Each tabbed have their own components properties.

You create tabs to JTabbedPane using the addTab( ). Each tab may contain other components.

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

class TabbedPaneDemo
    public static void main(String ar[])
        JFrame frame=new JFrame("Menus");
        JTabbedPane tp=new JTabbedPane();
        JPanel p1=new JPanel();
        JPanel p2=new JPanel();
        JPanel p3=new JPanel();
        tp.addTab("Panel 1",p1);
        tp.addTab("Panel 2",p2);
        tp.addTab("Panel 3",p3);
        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );


No comments:

Popular Posts