Source Code : Showing the Table Header in a Non-Scrollable JTable Component
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Showing the Table Header in a Non-Scrollable JTable Component
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.table.JTableHeader;
public class Main {
public static void main(String[] argv) throws Exception {
int rows = 10;
int cols = 5;
JTable table = new JTable(rows, cols);
JTableHeader header = table.getTableHeader();
JPanel container = new JPanel(new BorderLayout());
// Add header in NORTH slot
container.add(header, BorderLayout.NORTH);
// Add table itself to CENTER slot
container.add(table, BorderLayout.CENTER);
}
}
Thank with us