用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - java代码库

登录界面

2017-11-05 作者: 幽草举报

[java]代码库

package imitationQQ;



import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JWindow;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import javax.swing.JWindow;






public class LoginFrame extends JWindow {
	 private static final long serialVersionUID = 10L;
	    private boolean flag = false;
	 
	    public boolean isFlag() {
	        return flag;
	    }
	 
	    public void setFlag(boolean flag) {
	        this.flag = flag;
	    }
	private JLabel headImge;
	private JTextField usernameInput;
	private JTextField passwordInput;
	private JButton login;
	private JButton register;
	private int xx;
    private int yy;
    private boolean isDraging;
 
	
   
    public LoginFrame(int x, int y) {
        setLocation(null);
    }
	public LoginFrame() {
		setSize(445, 340);//澶у皬
		setLocationRelativeTo(null);//灞忓箷涓棿
		setVisible(true);//鏄剧ず
		//setResizable(false);//涓嶈兘鏀惧ぇ
		//setTitle("浠縌Q鑱婂ぉ杞欢");
		//setDefaultCloseOperation(EXIT_ON_CLOSE);
		setLayout(null);
		
		setIconImage(Toolkit.getDefaultToolkit().createImage("imge/qqTitle.png"));
		initComponet();
		paintComponents(getGraphics());
		paintAll(getGraphics());
	addMouseListener(new MouseAdapter() {
	            public void mousePressed(MouseEvent e) {
	                requestFocus();
	                isDraging = true;
	                xx = e.getX();
	                yy = e.getY();
	                
	}
	 public void mouseReleased(MouseEvent e) {
         isDraging = false;
     }

     public void mouseEntered(MouseEvent e) {
         
         setFlag(true);// 绐椾綋鍐呴儴鏆傛椂璁剧疆涓轰笉鑳藉彇鑹�
     }
 });
 addMouseMotionListener(new MouseMotionAdapter() {
     public void mouseDragged(MouseEvent e) {
         if (isDraging) {
             int left = getLocation().x;
             int top = getLocation().y;
             setLocation(left + e.getX() - xx, top + e.getY() - yy);
         }
     }
 });

 setVisible(true);

}
	
	
	

	public void initComponet() {
		headImge=new JLabel(new ImageIcon(Toolkit.getDefaultToolkit().createImage("imge/qqhead.png")));
		headImge.setSize(80, 80);
		headImge.setLocation(40, 165);
		this.add(headImge);
		
		usernameInput= new JTextField();
		usernameInput.setSize(200, 30);
		usernameInput.setLocation(135, 165);
		this.add(usernameInput);
		
		passwordInput= new JPasswordField();
		passwordInput.setSize(200, 30);
		passwordInput.setLocation(135, 190);
		this.add(passwordInput);
		
		login= new JButton("鐧诲綍");
		login.setSize(80, 25);
		login.setLocation(135,260);
		this.add(login);
		
		register= new JButton("娉ㄥ唽");
		register.setSize(80, 25);
		register.setLocation(255, 260);
		this.add(register);
	
	}
	
	
	
	
		public static void main(String[] args) {
			LoginFrame i=new LoginFrame();
		}
		
		
		
}
	



网友评论    (发表评论)

共4 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...