Tuesday, November 9, 2010

Write an application which will demonsrate the use of JTabbePane class to create a GUI with TabbedPanes.

/* Program : 5 
   Write an application which will demonsrate the use of JTabbePane class to create a GUI with TabbedPanes.
   Developed by : Malhar Vora
   Developed on : 8-11-2010
   Development Status : Completed and tested
   Email     : vbmade2000@gmail.com
   WebSite   : www.malhar2010.blogspot.com
*******************************************************************************************************************/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class P5 extends JFrame
{
 
 JLabel lblPage1 = null;
 JLabel lblPage2 = null;
 JTabbedPane mainTab = null;
 JPanel page1 = null;
 JPanel page2 = null;
 
 
 P5()
 {
  
  setSize(400,500);
  setTitle("Program 4 - Developed by Malhar Vora");
  setVisible(true);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  
  lblPage1 = new JLabel("This is first Page - 1");
  lblPage2 = new JLabel("This is first Page - 2");
  page1 = new JPanel();
  page2 = new JPanel();
    
  page1.setLayout(new BorderLayout());  
  page2.setLayout(new BorderLayout());  
  
  page1.add(lblPage1);
  page2.add(lblPage2);
  
  mainTab = new JTabbedPane();
  
  mainTab.addTab("Page 1",page1);
  mainTab.addTab("Page 2",page2);
  
  this.getContentPane().add(mainTab);
   
  
 }
 
 
 public static void main(String []str)
 {
  P5 p = new P5();
 }

}
 

 
 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.