I am working on a program for a small store. When I click the "Report" button, it should show a table, for example, this:

Column names "A", "B" ... "N" must be the names of employees. But I canβt understand how. Here is my code:
public void Inform() { String[] employee; String[] product[]; this.setLayout(null); Inform=new JTable(nulo, employee.length); model = new DefaultTableModel() { private static final long serialVersionUID = 1L; @Override public int getColumnCount() { return 1; } @Override public boolean isCellEditable(int row, int col) { return false; } @Override public int getRowCount() { return Inform.getRowCount(); } }; headerTable = new JTable(model); for (int i = 0; i < Inform.getRowCount(); i++) headerTable.setValueAt(product[i], i, 0); headerTable.setShowGrid(false); headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); headerTable.setPreferredScrollableViewportSize(new Dimension(50, 0)); headerTable.getColumnModel().getColumn(0).setPreferredWidth(50); scrollPane = new JScrollPane(Inform); scrollPane.setRowHeaderView(headerTable); scrollPane.setBounds(5,5,500,500); scrollPane.setEnabled(false); this.add(scrollPane); }
The employee and product varies depending on how much is introduced. Zero is how many products you are willing to sell.
source share