Results 1 to 5 of 5
  1. #1
    onefootswill is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default setting background color of JFrame form with NetBeans 6.1

    Hi,

    I am having trouble doing something which really shouldn't be difficult - setting the background color of a form.

    I am working in the NetBeans 6.1 IDE and the form is a JFrame Form.

    I have attempted to set the color of the background using the properties editor in the IDE, and I have also tried including
    Java Code:
    this.setBackground(Color.GREEN);
    in the constructor.

    If anyone can point out what I am missing, that would be fantastic.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Add a panel and change there color. Didn't you use any panel there? If you don't, amazing how did you working with controls.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    The mistake you have done there is not dealing with the container. You should have a container. So use a JPanal there or deal with the Container.

  4. #4
    onefootswill is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default

    Ok. Thanks. I'll add a panel.

    Cheers

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. How to Run a .exe in background???
    By jazz2k8 in forum New To Java
    Replies: 9
    Last Post: 01-21-2011, 12:27 PM
  2. JButton onClick change color background
    By behrk2 in forum AWT / Swing
    Replies: 6
    Last Post: 07-09-2008, 05:54 PM
  3. Replies: 2
    Last Post: 03-24-2008, 06:29 AM
  4. window background color?
    By javan00b in forum New To Java
    Replies: 3
    Last Post: 01-29-2008, 11:43 AM
  5. Problem Setting offscreen background
    By D34N0 in forum Java Applets
    Replies: 1
    Last Post: 07-14-2007, 12:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •