QQ界面实现

110 篇文章 22 订阅

随时随地阅读更多技术实战干货,获取项目源码、学习资料,请关注源代码社区公众号(ydmsq666)


import java.awt.Color;
import java.awt.Font;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class QQ extends JFrame {

	public QQ(){
		this.setLayout(null);
		Image img=new ImageIcon("img/QQ.png").getImage();
		img=img.getScaledInstance(80,80, 1);
		JLabel j=new JLabel(new ImageIcon(img));
		j.setBounds(10, 135, 80, 80);
		this.add(j);
		this.setUndecorated(true);
		
		Image img6=new ImageIcon("img/main.png").getImage();
		img=img6.getScaledInstance(29,19, 1);
		JLabel j8=new JLabel(new ImageIcon(img));
		j8.setBounds(280, 0, 29, 19);
		this.add(j8);
		j8.addMouseListener(new MinFrameEvent(this));
		
		Image img7=new ImageIcon("img/QQ7.png").getImage();
		img=img7.getScaledInstance(37,19, 1);
		JLabel j9=new JLabel(new ImageIcon(img));
		j9.setBounds(304, 3, 37, 19);
		this.add(j9);
		j9.addMouseListener(new CloseEvent());
		
		
		Image img3=new ImageIcon("img/QQ3.png").getImage();
		img=img3.getScaledInstance(21,21, 1);
		JLabel j5=new JLabel(new ImageIcon(img));
		j5.setBounds(245, 140, 21, 21);
		this.add(j5);
		
		Image img4=new ImageIcon("img/QQ4.png").getImage();
		img=img4.getScaledInstance(19,19, 1);
		JLabel j6=new JLabel(new ImageIcon(img));
		j6.setBounds(245, 173, 19, 19);
		this.add(j6);
		
		JTextField jtxt=new JTextField();
		jtxt.setBounds(103, 138, 165, 25);
		this.add(jtxt);
		
		JTextField jtxt1=new JTextField();
		jtxt1.setBounds(103, 170, 165, 25);
		this.add(jtxt1);
		
		JLabel i=new JLabel("注册账号");
		Font f=new Font("黑体",Font.BOLD,13);
		i.setFont(f); 
		i.setForeground(Color.BLUE); 
		i.setBounds(270, 143, 90, 13);
		this.add(i);
		
		JLabel j2=new JLabel("找回密码");
		Font f1=new Font("黑体",Font.BOLD,13);
		j2.setFont(f1); 
		j2.setForeground(Color.BLUE); 
		j2.setBounds(270, 174, 90, 13);
		this.add(j2);
		
		
		Image img1=new ImageIcon("img/QQ2.png").getImage();
		img=img1.getScaledInstance(30,30, 1);
		JLabel j3=new JLabel(new ImageIcon(img));
		j3.setBounds(103, 198, 30, 30);
		this.add(j3);
		
		JCheckBox jcb=new JCheckBox("记住密码");  
	    jcb.setBounds(140, 198, 80, 20);  
	    this.add(jcb);
	    
	    JCheckBox jcb1=new JCheckBox("自动登录");  
	    jcb1.setBounds(220, 198, 80, 20);  
	    this.add(jcb1);
	    
	    JButton f2=new JButton("设置");
		f2.setBounds(85, 245, 69, 19);
		this.add(f2);
		
		JButton f3=new JButton("登录");
		f3.setBounds(260, 245, 69, 19);
		this.add(f3);
	    
	    Image img2=new ImageIcon("img/QQ1.png").getImage();
		img=img2.getScaledInstance(69,20, 1);
		JLabel j4=new JLabel(new ImageIcon(img));
		j4.setBounds(6, 245, 69, 20);
		this.add(j4);
		
		Image img5=new ImageIcon("img/QQ6.png").getImage();
		img=img5.getScaledInstance(400,270, 0);
		JLabel j7=new JLabel(new ImageIcon(img));
		j7.setBounds(0, 0, 400, 270);
		this.add(j7);
		
		
		
		
		this.setSize(340,270);
		this.setVisible(true);
		this.setDefaultCloseOperation(3);
		this.setLocationRelativeTo(null);
		this.setResizable(false);
	}
	public static void main(String[] args) {
		QQ s=new QQ();
	}

}


package com;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class CloseEvent extends MouseAdapter {
	public void mouseClicked(MouseEvent e) {
		System.exit(0);
	}
}



package com;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;


import javax.swing.JFrame;
import javax.swing.JLabel;

public class MinFrameEvent extends MouseAdapter {
	JFrame frame;
	public MinFrameEvent(JFrame frame){
		this.frame = frame;
	}
	public void mouseClicked(MouseEvent e) {
		frame.setExtendedState(frame.ICONIFIED);//最小化窗口
	}
	
}
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class QQ extends JFrame {

	public QQ(){
		this.setLayout(null);
		Image img=new ImageIcon("img/QQ.png").getImage();
		img=img.getScaledInstance(80,80, 1);
		JLabel j=new JLabel(new ImageIcon(img));
		j.setBounds(10, 135, 80, 80);
		this.add(j);
		this.setUndecorated(true);
		
		Image img6=new ImageIcon("img/main.png").getImage();
		img=img6.getScaledInstance(29,19, 1);
		JLabel j8=new JLabel(new ImageIcon(img));
		j8.setBounds(280, 0, 29, 19);
		this.add(j8);
		j8.addMouseListener(new MinFrameEvent(this));
		
		Image img7=new ImageIcon("img/QQ7.png").getImage();
		img=img7.getScaledInstance(37,19, 1);
		JLabel j9=new JLabel(new ImageIcon(img));
		j9.setBounds(304, 3, 37, 19);
		this.add(j9);
		j9.addMouseListener(new CloseEvent());
		
		
		Image img3=new ImageIcon("img/QQ3.png").getImage();
		img=img3.getScaledInstance(21,21, 1);
		JLabel j5=new JLabel(new ImageIcon(img));
		j5.setBounds(245, 140, 21, 21);
		this.add(j5);
		
		Image img4=new ImageIcon("img/QQ4.png").getImage();
		img=img4.getScaledInstance(19,19, 1);
		JLabel j6=new JLabel(new ImageIcon(img));
		j6.setBounds(245, 173, 19, 19);
		this.add(j6);
		
		JTextField jtxt=new JTextField();
		jtxt.setBounds(103, 138, 165, 25);
		this.add(jtxt);
		
		JTextField jtxt1=new JTextField();
		jtxt1.setBounds(103, 170, 165, 25);
		this.add(jtxt1);
		
		JLabel i=new JLabel("注册账号");
		Font f=new Font("黑体",Font.BOLD,13);
		i.setFont(f); 
		i.setForeground(Color.BLUE); 
		i.setBounds(270, 143, 90, 13);
		this.add(i);
		
		JLabel j2=new JLabel("找回密码");
		Font f1=new Font("黑体",Font.BOLD,13);
		j2.setFont(f1); 
		j2.setForeground(Color.BLUE); 
		j2.setBounds(270, 174, 90, 13);
		this.add(j2);
		
		
		Image img1=new ImageIcon("img/QQ2.png").getImage();
		img=img1.getScaledInstance(30,30, 1);
		JLabel j3=new JLabel(new ImageIcon(img));
		j3.setBounds(103, 198, 30, 30);
		this.add(j3);
		
		JCheckBox jcb=new JCheckBox("记住密码");  
	    jcb.setBounds(140, 198, 80, 20);  
	    this.add(jcb);
	    
	    JCheckBox jcb1=new JCheckBox("自动登录");  
	    jcb1.setBounds(220, 198, 80, 20);  
	    this.add(jcb1);
	    
	    JButton f2=new JButton("设置");
		f2.setBounds(85, 245, 69, 19);
		this.add(f2);
		
		JButton f3=new JButton("登录");
		f3.setBounds(260, 245, 69, 19);
		this.add(f3);
	    
	    Image img2=new ImageIcon("img/QQ1.png").getImage();
		img=img2.getScaledInstance(69,20, 1);
		JLabel j4=new JLabel(new ImageIcon(img));
		j4.setBounds(6, 245, 69, 20);
		this.add(j4);
		
		Image img5=new ImageIcon("img/QQ6.png").getImage();
		img=img5.getScaledInstance(400,270, 0);
		JLabel j7=new JLabel(new ImageIcon(img));
		j7.setBounds(0, 0, 400, 270);
		this.add(j7);
		
		
		
		
		this.setSize(340,270);
		this.setVisible(true);
		this.setDefaultCloseOperation(3);
		this.setLocationRelativeTo(null);
		this.setResizable(false);
	}
	public static void main(String[] args) {
		QQ s=new QQ();
	}

}


package com;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class CloseEvent extends MouseAdapter {
	public void mouseClicked(MouseEvent e) {
		System.exit(0);
	}
}



package com;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;


import javax.swing.JFrame;
import javax.swing.JLabel;

public class MinFrameEvent extends MouseAdapter {
	JFrame frame;
	public MinFrameEvent(JFrame frame){
		this.frame = frame;
	}
	public void mouseClicked(MouseEvent e) {
		frame.setExtendedState(frame.ICONIFIED);//最小化窗口
	}
	
}
 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值