Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
| Search | Today's Posts | Mark Forums Read
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2006, 12:19 PM
Registered User
 
Join Date: Mar 2006
Location: Melbourne, Florida, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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




Similar Threads
Thread Thread Starter Forum Replies Last Post
JFrame class jagan7 Java Basics 2 August 15th, 2007 06:11 AM
jframe background darkfreedom Java GUI 0 August 4th, 2006 01:38 PM
JDesktopPane and JFrame mudasirw Java GUI 0 June 23rd, 2005 08:03 PM
Promblem in KeyListener on JFrame bamboat_3 Java GUI 1 May 28th, 2005 03:09 AM
Titlebar on JDialog/JFrame raven983 Java GUI 4 May 7th, 2005 07:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.