This is my Java code. In this code I am trying to add JTable on JFrame but table does not show on frame what is the problem in my code?
table_1 = new JTable();
table_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
table_1.setBorder(new LineBorder(new Color(0, 0, 0)));
table_1.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"Last Name", "First Name"
}
) {
Class[] columnTypes = new Class[] {
String.class, String.class
};
public Class getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
});
table_1.setBounds(20, 314, 1254, -74);
contentPane.add(table_1);