In this section you will learn about the packing of a JTable by adjusting it in the center.
Description of program:
This program helps you in packing a JTable component. For this you will need a JTable having the data and columns with column headers. To pack the JTable, you will need to apply the getPerferredScrollableVeiwportSize method that returns getPreferredSize. After doing entire process, you will get the packed JTable that always be in center.
Description of code:
This method returns a dimension containing the size of the viewport required for displaying visibleRowCount rows in JTable.
This method returns the preferred size of specified component.
Here is the code of program:
Output of program:
Liked it! Share this Tutorial