I would suggest that the column's are being overridden by those reported back by the table model. You could instead use...
String[] colNames = {"Item", "Count"};
DefaultTableModel dtm = new DefaultTableModel(colNames, 0);
JPanel j = new JPanel(new BorderLayout());
JTable t = new JTable(dtm);
t.setBackground(Color.GREEN);
t.getTableHeader().setReorderingAllowed(false);
t.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
t.getColumnModel().getColumn(0).setPreferredWidth(113);
j.add(new JScrollPane(t), BorderLayout.CENTER);
Instead...
Without seeing the code you're using to put the table on the frame, it's difficult to comment further, however...
- Avoid using
setBounds
, it's pointless in this context any way. - The background color will actually be defined more by the view port then the table or panel until the table is either configured to fill the empty space or has enough rows to fill the empty space