JTable columnName not visible
Hii Javaites
I am creating JTable in the following way
private DefaultTableModel model = new DefaultTableModel();
model.addColumn("Name");
model.addColumn("Date");
model.insertRow(0, new Object[]{"Smith","18/05/06"});
JTable table = new JTable(model);
I am getting the JTable displayed minus the column Name i,e "Name" and "Date".
Can anyone tell me wht is wrong here
Yes i did not created table on JScrollPane.
I am creating a JPanel(MainPanel) , which consists of two more JPanels (addPanel and diplayPanel )
I am creating a JTable in diplayPanel .
But as u said tht i should create a table in JScrollPanel.
I did that and added that ScrollPanel to my JPanel (MainPanel)
But in this way i am getting a line visible i.e No rows and no columns are visible.
So can u plz tell me what went wrong ?
Can we add a JScrollPane to a JPanel ?