Click to See Complete Forum and Search --> : JTable - Setting the Background


mrn
March 29th, 2001, 10:29 AM
On my window I need to display a JTable that's empty initially. I want to set the background color to something that I specified instead of setting it to the default gray color. How do I do this?

Note: I create the JTable specifying just the number of rows and columns, then add this table to a JScrollPane and add this to a JPanel.

Thanks in advance.
mrn

mrn
March 30th, 2001, 09:48 AM
Never mind, the following code does the job.

scrollPane.getViewport().setBackground(Color.white);

mrn.