1

I have code like below:

table_1 = new JTable();

table_1.setModel(new DefaultTableModel(
    new Object[][] {
        {null, null, null, null, null, null, null},
    },
    new String[] {
        "Product Code", "Description", "Price", "Quantity", "Total ", "Discount", "Remarks"
    }
));

I want to see column header names. I tried with this code, but I cant see the names. I want to know how to do that?

Also, I also want to set the cell value which is coming from a JTextField.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Balkrushn
  • 91
  • 1
  • 1
  • 12

1 Answers1

4

The column names won't show up until you add table_1 to a JScrollPane, like they show in the tutorial.

Catalina Island
  • 7,027
  • 2
  • 23
  • 42