Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

/* * To change this template, choose Tools | Templates * and open the template in the editor.

*/ package javaapplication5; /** * * @author pc */ import javax.swing.*; class tab extends JFrame { tab() { //1. Create object of JTabbedPane JTabbedPane t=new JTabbedPane();

//2.create panels JPanel somePanel = new JPanel(); JPanel somePanel2 = new JPanel(); //3. add panels to the tabbedpane t.addTab("one", somePanel); t.addTab("two", somePanel2); //4Set layouts of panels somePanel.setLayout(null); //5.create contols object and add to first panel JLabel a1=new JLabel("ID"); a1.setBounds(50,50,100,100); somePanel.add(a1);

//6.create contols object and add to second panel JLabel a11=new JLabel("Name"); somePanel2.add(a11); //7. add tabbedpane to frame add(t); setSize(1000,1000); show(); } } class tab1 { public static void main(String[] arg)

{ tab t=new tab(); } }

You might also like