The program uses JTable class which is used to display data in tabular form. 2 array objects to store the data and the title of the table & scrolPane for providing a scrollable view.

Classes and Methods Used in program

  1. JFrame Class: JFrame s is a window with borders and title. It places several components including container object
  2. JTable: This class is used to display & edit the data stored in tabular form.There are various constructors used to display Table but the constructor used in program is as follows:

                                          JTable (Object [][]data,String [] title)

It constructs a table to display the data in two dimentional array, data with column name as title

JScrollPane Class: This class provides a scrollable area. It manages a viewport with horizontal & vertical scrollbars


import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class TableDemo extends JFrame
JTable jtable;
JScrollPane jsp;
Container cp;
Object [][]data = {{“Amit”,”Goyenka”,”System Administrator”,new Integer(5)},{“Jitesh”,”Kabra”,”System Analyst”,new Integer(4)},{“Kunal”,”Shah”,”Web Designer”,new Integer(3)},{“Rahul”,”Mishra”,”Peon”,new Integer(2)},{“Paresh”,”Patel”,”Software Testor”,new Integer(4)}};
String [] title = {“First Nmae”,”Last Name”,”Desgnation”,”Experience”};
cp = getContentPane();
cp.setLayout(new FlowLayout());
jtable = new JTable(data,title);
jsp = new JScrollPane(jtable);

public static void main(String[] args)
// TODO code application logic here
TableDemo t1 = new TableDemo();



We're not around right now. But you can send us an email and we'll get back to you, asap.


©2023 An initiative by some failures to make student scholars.


Log in with your credentials

Forgot your details?