JFrame.setBackground() not working -- why?

Posted by devoured elysium on Stack Overflow See other posts from Stack Overflow or by devoured elysium
Published on 2010-04-30T04:22:31Z Indexed on 2010/04/30 4:27 UTC
Read the original article Hit count: 256

Filed under:
|
    JFrame mainFrame = new JFrame();
    mainFrame.setSize(100, 100);
    mainFrame.setBackground(Color.CYAN);
    mainFrame.setVisible(true);

My intent is to create a window with a cyan background. What is wrong with this? My window doesn't get cyan, as I'd expect!

Also, could anyone point out why I seem to have all the colors in duplicate (there's a Color.CYAN and a Color.cyan). Is there any difference at all between the two? Maybe the older one was a constant from before there were enums in Java and the second one is from the Enum?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about swing