Javatpoint Logo
Javatpoint Logo

Java JTable

The JTable class is used to display data in tabular form. It is composed of rows and columns.

JTable class declaration

Let's see the declaration for javax.swing.JTable class.

Commonly used Constructors:

Constructor Description
JTable() Creates a table with empty cells.
JTable(Object[][] rows, Object[] columns) Creates a table with the specified data.

Java JTable Example

Output:

JAVA Jtable 1

Java JTable Example with ListSelectionListener

Output:

JAVA Jtable 2

If you select an element in column NAME, name of the element will be displayed on the console:

Next TopicJava JList





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA