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 the use of double buffering in swings?

560


How to print in java swing application?

513


What is the difference between swing and awt in java?

547


What is the difference between invokeAndWait() and invokeLater()?

597


What is an on stage swing?

549






What is import javax swing jframe?

554


How is parsing html used in swing?

567


What is java swing gui?

474


What are the two key features of swing?

536


How to reload a jframe in java swing?

550


How does accessibility works in swings?

555


What is the base class for all swing components?

610


What is Java Swing?

606


What is an event in Swing?

609


Which method of the Component class is used to set the position and size of a component?

570