I use JTattoo look and feel in my project. I try to change font of table heading using the following code:
tbExpense.getTableHeader().setFont(new java.awt.Font("Kerala", 1, 14));
But it is not working.
my code
following code for internal frame, i apply jtatto look and feel in Mainframe. this is the subframe. all other components in the frame changed to jtattoo look and feel but i cant change the jtable header font
public class T extends javax.swing.JInternalFrame {
public T() {
initComponents();
tb.getTableHeader().setFont(new java.awt.Font("Kerala", 1, 14));
tb.getTableHeader().repaint();
}
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tb = new javax.swing.JTable();
setClosable(true);
setTitle("Hai");
setVisible(true);
tb.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tb);
setBounds(0, 0, 461, 372);
}
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tb; }
试试看
UIManager.put("TableHeader.font",new Font("Arial", Font.BOLD, 18) );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.