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:
Ask Questions? Discuss: Getting the Number of Rows and Columns in JTable
Post your Comment
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.