您的位置:首页 > 其它

以图片为背景 的登陆界面

2013-07-15 21:33 387 查看
//以图片为背景 的登陆界面

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);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: