What is JTable and what is its purpose?

Answer Posted / narmada

The JTable is used to display and edit regular two-dimensional tables of cells.

The JTable has many facilities that make it possible to customize its rendering and editing but provides defaults for these features so that simple tables can be set up easily. For example, to set up a table with 10 rows and 10 columns of numbers:

TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() { return 10; }
public int getRowCount() { return 10;}
public Object getValueAt(int row, int col) { return new Integer(row*col); }
};
JTable table = new JTable(dataModel);
JScrollPane scrollpane = new JScrollPane(table);

Is This Answer Correct ?    10 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is swing gui?

504


What are the containers available in swing?

524


What is the difference between a scrollbar and a jscrollpane ?

763


Is java swing a framework?

562


What is difference between awt and swing?

567






Why are swing components called lightweight components?

478


What is the function of internal frame in swing?

611


What is swing in java javatpoint?

534


How to generate bill in java swing?

682


How to create a swing gui in java?

528


What is an event in Swing?

601


What are swing components?

597


What is the use of jfc in java swing?

655


What is the difference between swing and awt?

536


What is the purpose of transferhandler class?

557