I tried a simple program to add an image on the background of a frame using java swing. But whenever I resize the frame the background image size remains the same. That means If I shorten my frame, the image is cut, only a little portion of the image is seen. If I enlarge the frame then the new portion of my frame takes default white color. How can I solve it?
ImageIcon img= new ImageIcon("gari.png");
JLabel back_img= new JLabel(img);
background frem = new background();`your text`
frem.getContentPane().add(back_img);