Setting Background image of JFrame containg Components
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVkKnechP_z8uKjMOCTTafoDDSSPfWvhsPUwfvKFiq1EmSVCaH_w6ixMyt6Z0HAdCoApzOs2Boz97I_8W6F3YfiyRlFRFjDY3d40KH7ZiIVAagKQUm-bUBLlMzWne3Lg7hi7xTeau7k3g/s1600/output.jpg)
Step 1- Save the following source code in a file named "LoginPanel.java" import java.awt.*; import javax.swing.*; class BgPanel extends JPanel { Image bg = new ImageIcon("Back.jpg").getImage(); public void paintComponent(Graphics g) { g.drawImage(bg, 0, 0, getWidth(), getHeight(), this); } BgPanel() { JLabel l1=new JLabel("Username: "); JLabel l2=new JLabel("Password: "); JTextField t1=new JTextField(15); JTextField t2=new JTextField(15); JButton b1=new JButton("Login"); JButton b2=new JButton("Cancel"); l1.setBounds(20,40,90,25); l2.setBounds(20,70,90,25); t1.setBounds(120,40,170,25); t2.setBounds(120,70,170,25); ...