Hello All,
I have this code.
I keep getting this error: The method setDefaultRenderer invoked for type javax.swing.table.JTableHeader with arguments (javax.swing.table.DefaultTableCellRenderer) is not defined
I don't know why I get this error so if someone could help me. and let me know how I should address my code so that the text in the JTables header is blue, it would be great.
Thanks
Ben
{code]
int j=1;
String[][] data = new String[j][2];
for (int k=0; k<j; k++){
String[] row = {"",""};
data[k] = row;
}
String[] columnNames = {"Table Name","Column Name"};
ivjScrollPaneTable = new javax.swing.JTable(data, columnNames);
javax.swing.table.DefaultTableCellRenderer headerRenderer = new javax.swing.table.DefaultTableCellRenderer();
headerRenderer.setForeground(java.awt.Color.blue);
headerRenderer.setFont(headerRenderer.getFont().deriveFont(java.awt.Font.BOLD));
ivjScrollPaneTable.getTableHeader().setDefaultRenderer(headerRenderer);
ivjScrollPaneTable.setName("ScrollPaneTable");
getJScrollPane1().setColumnHeaderView(ivjScrollPaneTable.getTableHeader());
getJScrollPane1().getViewport().setBackingStoreEnabled(true);
ivjScrollPaneTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
ivjScrollPaneTable.setSelectionForeground(java.awt.Color.black);
ivjScrollPaneTable.setForeground(java.awt.Color.black);
ivjScrollPaneTable.setGridColor(java.awt.Color.black);
ivjScrollPaneTable.setBounds(0, 0, 450, 400);
ivjScrollPaneTable.setSelectionBackground(java.awt.Color.white);
[/code]