Sunday, May 6, 2012

How to set background image to jFrame form in netbeans

6 comments

Some times we get problem while customizing code.Problem is we don't know how?. Here is simple example of how to set background image to jFrame form in netbeans.

  • First open new project and name it.
  • Right click on source package and add new jFrame form
  • Set the title for jFrame form, Right click on jFrame and type title in front of title option.
  • For setting background image to jFrame form first we should set Null Layout because default layout is Free Design Layout.
  • To set Null Layout, Right Click on jFrame --> set layout --> select Null Layout.
  • After setting null layout drag and drop jlabel from pallet.
  • Drag jLabel over the full jFrame.
  • To set background image, Right click on jLabel --> Icon --> select image
  • Your jFarme is look like as.
  • Again if you go for another jLabel you find that jLabel is not visible it just behind the jFrame.
  • For that just select second jLabel, Drag and drop above the first jLabel.
  • See the output for this jFrame. By this way you can customize your jFrame and add another components.

6 Responses so far

  1. Unknown says:

    you guys were the most helpful!!! amaze!!

  2. Anonymous says:

    How can i set the size mode of the icon?
    I want to keep it 'fit in the frame' ut how to do it?

  3. webseos says:

    When you have components to show like Text Box or Buttons how to show them, I have seen this method, but should be some clean way. Thanks

    Online Java Courses Kolkata

  4. ronnel says:
    This comment has been removed by the author.
  5. ronnel says:

    the layout was ruined because of null layout.

Leave a Reply