Results 1 to 6 of 6
  1. #1
    851marc is offline Member
    Join Date
    Mar 2010
    Posts
    3
    Rep Power
    0

    Post JFrame image background

    Hi, I am trying to put a background to my JFrame I have a label witch contain the image but I don't find the way to set it as the backgroup of my JFrame so now I can't add any component in front of my Label. How can I do that ?

    Thx for your help.

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Look at the Sun Java Tutorial for Swing, go to the part about layered pane.

  3. #3
    851marc is offline Member
    Join Date
    Mar 2010
    Posts
    3
    Rep Power
    0

    Default

    Is there any way to do it cliking on something in NetBeans?

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I assume you are using Matisse, which is included in NetBeans. I don't mean to be negative, but Swing is made for creating heavy-duty applications. That means you have to know how the internals work and to write somewhat low-level code. It is not a lot of code, but you have to do it right, or you will end up with, at best, an applications that is slow and filled with problems. Do it right, and Swing rocks. Please read the Swing tutorial, from the start.

  5. #5
    851marc is offline Member
    Join Date
    Mar 2010
    Posts
    3
    Rep Power
    0

    Default

    Yeah, I start redaing it and trying understanding how it work xD and I look into NetBeans generated code and this is wierd plus one of the method that work in eclipse dosen't work into netBeans.

    Point origin = new Point(10, 20);
    label = createColoredLabel(" ",java.awt.Color.BLACK, origin);
    jLayeredPane1.add(label);

    createColoredLabel() dosen't work because of a
    "Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code"

    EDIT: are you sure I can use that for a picture because in the tutorial they are only talking about color.
    Last edited by 851marc; 03-09-2010 at 06:18 PM.

  6. #6
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    I have a label witch contain the image but I don't find the way to set it as the backgroup of my JFrame so now I can't add any component in front of my Label. How can I do that ?
    Background Panel shows you an easy way to do this.

Similar Threads

  1. How to add a background image to JFrame
    By dunafrothint in forum AWT / Swing
    Replies: 1
    Last Post: 02-26-2010, 10:17 PM
  2. Need help with JFrame background image
    By ProGenius in forum New To Java
    Replies: 6
    Last Post: 12-27-2009, 04:17 PM
  3. JFrame window doesnt change background color
    By Addez in forum New To Java
    Replies: 7
    Last Post: 11-07-2009, 09:38 PM
  4. Background in JFrame ( GUI).
    By Twister03 in forum AWT / Swing
    Replies: 2
    Last Post: 03-12-2009, 03:24 AM
  5. Replies: 2
    Last Post: 03-24-2008, 05:29 AM

Posting Permissions

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