I'm trying to add a JTable into the frame, but no works, i had tried:
public Jtablee()
{
setSize(400,400);
String[] columnsNames = {"firstName", "LastName", "sport", "# ofYear", "vegetarian"};
Object[][] data = {{"Katty", "Smith", "SnowBoard", new Integer(5), new Boolean(false)}, {"Jhon", "Doe", "Rowing", new Integer(3), new Boolean(true)},
{"Sue", "Black", "Knitting", new Integer(2), new Boolean(false)},{"Jane", "White", "Speed ride", new Integer(20), new Boolean(true)}};
JTable t = new JTable(data, columnsNames);
add(t.getTableHeader(), BorderLayout.PAGE_START);
add(t, BorderLayout.CENTER);
setLayout(new BorderLayout());
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
Just the blank frame appear, without the JTable
Note: I don't want to add it into a scrollPane, I wanna add it directly.