随时随地阅读更多技术实战干货,获取项目源码、学习资料,请关注源代码社区公众号(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);//最小化窗口
}
}