import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
public class LoginJF{
//实现界面组件
public LoginJF() {
// TODO Auto-generated constructor stub
}
private void loadJF() {
// TODO Auto-generated method stub
JFrame jFrame= new JFrame();
jFrame.setVisible(true);
jFrame.setSize(600,400);
//设置窗体默认居中
jFrame.setLocationRelativeTo(null);
jFrame.setTitle("QQ聊天");
jFrame.setResizable(false);
try {
Image img = ImageIO.read(this.getClass().getResource("/images/pifu/1.jpg"));
jFrame.setIconImage(img);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JPanel loginJP = new JPanel();
JPasswordField pwdTF = new JPasswordField();
pwdTF.setBounds(150,210,150,26);
loginJP.add(pwdTF);
//登录按钮
JButton JB = new JButton("登录");
JB.setBounds(150, 250, 100, 26);
loginJP.add(JB);
//登录窗体背景图片
JLabel bgImage =new JLabel("");
bgImage.setBounds(0, 0, 429, 156);
//设置背景图片
bgImage.setIcon(new ImageIcon(this.getClass().getResource("/images/FormImage/QQ.PNG")));
loginJP.add(bgImage);
jFrame.add(loginJP);
}
public static void main(String[] args) {
LoginJF loginJF=new LoginJF();
loginJF.loadJF();
}
}