package cn.itcast;
import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Demo {
public static void main(String[] args) {
Toolkit tool = Toolkit.getDefaultToolkit();
JFrame frame = new JFrame("QQ登录管理");
frame.setBounds(300, 200, 430, 340);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
// frame.setIconImage(tool.createImage("title.png"));
JLabel label = new JLabel(new ImageIcon("q1.jpg"));
frame.add(label, BorderLayout.NORTH);
JTextField userNameField = new JTextField();
JPasswordField passwordField = new JPasswordField();
userNameField.setBounds(133, 170, 192, 30);
passwordField.setBounds(133, 200, 192, 30);
frame.add(userNameField);
frame.add(passwordField);
JButton btn = new JButton("注册账号");
btn.setBounds(332, 176, 80, 20);
frame.add(btn);
JButton btn1 = new JButton("找回密码");
btn1.setBounds(332, 203, 80, 20);
frame.add(btn1);
JButton btn2 = new JButton("登录");
btn2.setBounds(132, 260, 200, 35);
frame.add(btn2);
JButton btn3 = new JButton("");
btn3.setBounds(138, 300, 200, 35);
frame.add(btn3);
frame.setVisible(true);
btn2.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
new Demo_1();
}
});
}
public static void CeShi(){
//String str = Integer. userNameField.getText();
}
}
class Demo_1{
public Demo_1(){
JFrame frame1 = new JFrame("QQ");
frame1.setBounds(500, 200, 280, 650);
frame1.setResizable(false);
JLabel label = new JLabel(new ImageIcon("qq111.jpg"));
frame1.add(label, BorderLayout.NORTH);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame1.setVisible(true);
}
} |
|