//以圖片為背景 的登陸介面import java.awt.*;import javax.swing.*;public class Image extends JFrame {private JLabel jlable1, jlable2, jlable3;private JTextField jtext1, jtext2;private JButton jbutton1, jbutton2;private ImageIcon ico;private JLayeredPane lay;private JPanel jpan1;public Image() {setBounds(300, 200, 300, 250);jlable1 = new JLabel("使用者名稱:");jlable2 = new JLabel("密碼:");jtext1 = new JTextField(20);jtext2 = new JTextField(20);jbutton1 = new JButton("登陸");jpan1 = new JPanel();jpan1.setLayout(null);jpan1.add(jlable1);jlable1.setBounds(30, 40, 50, 20);jpan1.add(jtext1);jtext1.setBounds(80, 40, 150, 20);jpan1.add(jlable2);jlable2.setBounds(30, 80, 50, 20);jpan1.add(jtext2);jtext2.setBounds(80, 80, 150, 20);jpan1.add(jbutton1);jbutton1.setBounds(80, 150, 100, 30);ico = new ImageIcon("images/1.jpg");jlable3 = new JLabel(ico);jlable3.setBounds(0, 0, ico.getIconWidth(), ico.getIconHeight());this.getLayeredPane().setLayout(null);this.getLayeredPane().add(jlable3, new Integer(Integer.MIN_VALUE));this.setContentPane(jpan1);jpan1.setOpaque(false);}public static void main(String args[]) {new Image().setVisible(true);}}