Sunday, May 6, 2012

How to set background image to jFrame form in netbeans

0 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.

Leave a Reply