help with JFrame.setBackground(...)
Hello,
I am reading the book Java 2 JDK 5 Edition by Ivor Horton. On page
789, the author gave an example of how to change the colour of a JFrame: [b]aWindow.setBackground(Color.PINK), but when I tried this line of code, it does not work. I had to do some other fancy stuff,
I tried the following two ways to get it to work
1)aWindow.getContentPane().setBackground(Color.PIN K);
2) aWindow.setBackground(Color.pink);
aWindow.getContentPane().setVisible(false);
My question is why aWindow.setBackground(Color.PINK) does not work, even though the method setBackground is in Component? I have work around, but I would like to have some explaination. Does it have anything to do with heavy weight versus light weight?
Thanks very much
Dzunguyen
Dzunguyen
|