Man, you are really the problem-cracker!!!
And I added several lines so that I can filter components with a given property:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if(comp[x] instanceof JButton &&((JButton)comp[x]).getText().equals("OK"))
{comp[x].setBackground(oKButtonColor);}
if(comp[x] instanceof JButton &&((JButton)comp[x]).getText().equals("Cancel"))
{comp[x].setBackground(cancelButtonColor);}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I used short circuit "&&" so that if the component is not a JButton, the type casting won't take place.
Now I have been able to set a background color to the whole GUI, while setting specific colors to certain components.
Thank you!
[ November 02, 2006: Message edited by: Biliang Zhou ]