JTable table = new JTable(data, columnNames); // data and columnNames are defined elsewhere Font font = new Font("Arial", Font.BOLD, 12); table.getTableHeader().setFont(font); table.setFont(font);
JTable table = new JTable(data, columnNames); // data and columnNames are defined elsewhere Font font = new Font("Verdana", Font.PLAIN, 14); table.setFont(font);In this example, we create a JTable object and set its data and column names. We then create a Font object with Verdana font, plain style, and size 14. We set the font of the table data rows using the setFont method of the table. The package library used in these examples is javax.swing.