JTabbedPane class in java

 //JTabbedPane

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

class JTabbedPane_demo extends JFrame
{
    Container con;
    JButton btn1, btn2, btn3;
    JLabel lbl1, lbl2, lbl3;
    JPanel p1, p2;
    JTabbedPane tp;

    JTabbedPane_demo()
    {
        con = getContentPane();
        con.setLayout(new FlowLayout());

        p1 = new JPanel();
        p1.setLayout(new FlowLayout());

        btn1 = new JButton("BTN - 1");
        p1.add(btn1);
        btn2 = new JButton("BTN - 2");
        p1.add(btn2);
        btn3 = new JButton("BTN - 3");
        p1.add(btn3);

        p2 = new JPanel();
        p2.setLayout(new FlowLayout());

        lbl1 = new JLabel("LBL - 1");
        p2.add(lbl1);
        lbl2 = new JLabel("LBL - 2");
        p2.add(lbl2);
        lbl3 = new JLabel("LBL - 3");
        p2.add(lbl3);

        tp = new JTabbedPane();
        tp.add("Buttons", p1);
        tp.add("Labels", p2);
        con.add(tp);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    public static void main(String[] args) {
        JTabbedPane_demo obj = new JTabbedPane_demo();
        obj.setSize(500, 400);
        obj.setVisible(true);
    }
}

OUTPUT:



 

Comments

Popular posts from this blog

7.Write a program to read a list containing item name, item code and cost interactively and produce a three-column output as shown below. NAME CODE COST Turbo C++ 1001 250.95 C Primer 905 95.70 ------------- ------- ---------- ------------- ------- ---------- Note that the name and code are left-justified and the cost is right-justified with a precision of two digits. Trailing zeros are shown.

Quetion 6 : Consider the "in-order-issue/in-order-completion" execution sequence shown in f In Figure Decode OWE Execute 12 12 12 14 16 13 16 13 15 15 16 Write 024/06/02 11 3 4 11 12 13 13 N 15 16 a. Identify the most likely reason why I could not enter the execute fourth cycle. stage until the [2] b. Will "in-order issue/out-of-order completion" or "out-of-order issue/out-of-order completion" fix this? If so, which? Explain

8.odd and even number using if else.