In this java tutorial you will learn how to get the number of rows and columns in JTable.
This program simply helps us for getting the number of rows and columns from the JTable by using the some java methods. For this, you must have to create a table with some data in the table. Here the table appears on the frame as a graphical format and you get the number of rows and column to its name (Column name) in the command line with appropriate messages.
Description of code:
Above method is used for getting the number of columns in the column model that returns integer type values.
This method returns integer types value that is number of rows in the model of table.
Here is the code of program:
Output of program:
Number of Columns: 3
Number of Rows: 4
Name of column:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Getting the Number of Rows and Columns in JTable
Post your Comment