 import java.io.*;	   
import java.util.*;
import javax.swing.*;
 import javax.swing.table.*;
 import java.awt.*;
     public class JTableP extends JPanel
     {
	 private static final long serialVersionUID = 43567894L;	    
	 public void kur(Object a[][],String heading[])
	 {	 
	 int n=a.length;
	 int m=a[0].length;
	 JTable jt=new JTable(a,heading);
	 jt.setPreferredScrollableViewportSize(new Dimension(500,100));
	 jt.setFillsViewportHeight(true);
     add(new JScrollPane(jt));
     }
     public void kur(Object a[][])
	 { int n=a[0].length;
	   String heading[]=new String[n];
	   char b='\u0041';
       for(int i=0;i<n;i++)
       {heading[i]=""+b;b++;}
       kur(a,heading);
     }         
     public JTableP(Object a[][],String heading[])
     {kur(a,heading);}    	 
	 public JTableP(Object a[][])
	 { kur(a);}	      
	 public JTableP(double b[][])
	 { Object a[][]=doubletoDouble(b);
	   kur(a);
	 }
	 public JTableP(double b[][],String heading[])
	 { Object a[][]=doubletoDouble(b);
	   kur(a,heading);
	 }	 
	 public JTableP(int b[][])
	 { Object a[][]=inttoInteger(b);
	   kur(a);
	 }	 
	 public JTableP(int b[][],String heading[])
	 { Object a[][]=inttoInteger(b);
	   kur(a,heading);
	 }	  
	 public static void print(Object a[][],String heading[],String bb)
     {
	 JTableP pp=new JTableP(a,heading);
     JFrame frame=new JFrame(bb);
     frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
     frame.getContentPane().add(pp);
     frame.pack();
     frame.setVisible(true);
	 }	 
	 public static void print(Object a[][],String bb)
	 {  
	   int n=a[0].length;
	   String heading[]=new String[n];
	   char b='\u0041';
       for(int i=0;i<n;i++)
       {heading[i]=""+b;b++;}
       JTableP pp=new JTableP(a,heading);
	   JFrame frame=new JFrame(bb);
       frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
       frame.getContentPane().add(pp);
       frame.pack();
       frame.setVisible(true);
	 }	 
	 public static void print(Object a[][])
	 { 	   int n=a[0].length;
	   String heading[]=new String[n];
	   char b='\u0041';
       for(int i=0;i<n;i++)
       {heading[i]=""+b;b++;}
       JTableP pp=new JTableP(a,heading);
	   JFrame frame=new JFrame("JTable");
       frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
       frame.getContentPane().add(pp);
       frame.pack();
       frame.setVisible(true);
	 }	 	 
	 public static void print(double a[][],String heading[],String bb)
	 {print(doubletoDouble(a),heading,bb);}
	 public static void print(double a[][],String bb)
	 {print(doubletoDouble(a),bb);}
	 public static void print(double a[][])
	 {print(doubletoDouble(a));}  
	 public static void print(int a[][],String heading[],String bb)
	 {print(inttoInteger(a),heading,bb);} 
	 public static void print(int a[][],String bb)
	 {print(inttoInteger(a),bb);} 
	 public static void print(int a[][])
	 {print(inttoInteger(a));} 	    
	 public static Double[][] doubletoDouble(double xi[][])
     { int n=xi.length;
     int m=xi[0].length;
     Double X[][]=new Double[n][m];
     for(int j=0;j<m;j++)
       {for(int i=0;i<n;i++)
       {X[i][j]=new Double(xi[i][j]);}	  
       }
     return X;
     }    
     public static Integer[][] inttoInteger(int xi[][])
     { int n=xi.length;
     int m=xi[0].length;
     Integer X[][]=new Integer[n][m];
     for(int j=0;j<m;j++)
       {for(int i=0;i<n;i++)
       {X[i][j]=new Integer(xi[i][j]);}	  
       }
     return X;
    }
 
	 public static void main(String arg[])
	 {double a[][]={{1.1,2.2,3.3,4.4},{4,4,5.5,6.6,7,7},{7,7,8.8,9.9,10.1},{10.1,11.2,12.3,13.4}};
	 print(a,"JTable example");}	 
}
