TXT

taohuaupload_loginqq

By Juanita Stone,2014-12-14 00:24
6 views 0
taohuaupload_loginqq...

Ì??òµ?ÁË??Äã??????

package dyno.swing.beans.qq;

import javax.swing.*;

    import javax.swing.event.MouseInputListener;

import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;

    /*import org.jvnet.substance.skin.SubstanceModerateLookAndFeel;

    import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;*/

import java.awt.*;

    import java.awt.event.ActionEvent;

    import java.awt.event.ActionListener; import java.awt.event.MouseEvent;

    import java.io.IOException;

    import java.io.PrintWriter;

    import java.net.Socket;

    import java.net.UnknownHostException; import java.sql.ResultSet;

    import java.sql.SQLException;

    import java.util.Scanner;

public class QQLogin extends JFrame implements MouseInputListener,ActionListener{

    JLabel guanggao,beijing,wenzi,shezhi,zhanghaowb,qq1,dengluzhuangtai;

    // JTextField zhanghao;

JPopupMenu haoma;

    JComboBox zhanghao;

    JPasswordField mima;

    JCheckBox jizhumima,zidongdenglu;

    JButton denglu,chashamuma;

    JProgressBar jpb;

    SimThread activity;

    Timer activityMonitor;

    String name,qq;

    Socket s;

    public QQLogin()

    {

    try {

    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

    } catch (ClassNotFoundException e1) { // TODO ×Ô??Éú?É catch ?é

    e1.printStackTrace();

    } catch (InstantiationException e1) { // TODO ×Ô??Éú?É catch ?é

    e1.printStackTrace();

    } catch (IllegalAccessException e1) { // TODO ×Ô??Éú?É catch ?é

    e1.printStackTrace();

    } catch (UnsupportedLookAndFeelException e1) { // TODO ×Ô??Éú?É catch ?é

    e1.printStackTrace();

    }

    chashamuma = new JButton("?éÉ?Ä?Âí"); chashamuma.setBounds(240, 155,85, 20); this.add(chashamuma);

    jpb = new JProgressBar();

    jpb.setStringPainted(true);

    jpb.setBounds(100, 240, 200, 15);

    this.add(jpb);

    chashamuma.addActionListener(new ActionListener(){

    public void actionPerformed(ActionEvent e){

    jpb.setMaximum(1000);//ÉèÖÃ?ø?ÈÀ?µÄ×î?óÖµ activity=new SimThread(1000);

    activity.start();//Æô??Ïß?Ì

    activityMonitor.start();//Æô????Ê?Æ? chashamuma.setEnabled(false);//?ûÖ???Å? }

    });

    activityMonitor=new Timer(100,new ActionListener(){//Ã?0.5ÃëÖ?ÐÐÒ??Î

    public void actionPerformed(ActionEvent e){//ÒÔÏÂ??×???ÔÚÊÂ?þµ??ÈÏß?ÌÖÐÔËÐÐ??Ê??Ö??È?

    int current=activity.getCurrent();//µÃµ?Ïß?̵ĵ?Ç??ø?È

    jpb.setValue(current);//?üÐÂ?ø?ÈÀ?µÄÖµ

    if(current==activity.getTarget()){//Èç?ûµ??ïÄ??êÖµ activityMonitor.stop();//ÖÕÖ???Ê?Æ?

    chashamuma.setEnabled(true);//???î??Å? }

    }

    });

    dengluzhuangtai = new JLabel(new ImageIcon("zaixianzhuangtai.jpg"));

    dengluzhuangtai.setBounds(75, 145, 35, 30);

this.add(dengluzhuangtai);

    dengluzhuangtai.addMouseListener(this); denglu = new JButton("µÇÂ?");

    denglu.setBounds(140, 155, 80, 20);

    this.add(denglu);

    this.setAlwaysOnTop(true);

    zidongdenglu = new JCheckBox("×Ô??µÇÂ?"); zidongdenglu.setBounds(200, 190, 100, 30); this.add(zidongdenglu);

    jizhumima = new JCheckBox("?Ç×?ÃÜÂë");

    jizhumima.setBounds(100, 190, 100, 30); // jizhumima.setBackground(new Color(228, 244, 255)); this.add(jizhumima);

haoma = new JPopupMenu();

/* zhanghao = new JTextField(20);

    zhanghao.setBounds(120, 78, 135, 20);

    zhanghao.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.WHITE));

    zhanghao.setFont(new Font("ËÎÌå",Font.PLAIN,13)); this.add(zhanghao);*/

    // zhanghaowb = new JLabel(new ImageIcon("2.png")); // zhanghaowb.setBounds(90, 73, 194, 31); // jiantou = new JLabel(new ImageIcon("baijiantou.png")); // jiantou.setBounds(256, 78, 23, 21);

    // jiantou.addMouseListener(this);

    // this.add(jiantou);

    // this.add(zhanghaowb);

    chashamuma.addActionListener(this);

    mima = new JPasswordField();

    mima.setEchoChar('*');

    mima.setFont(new Font("ËÎÌå",Font.PLAIN,13)); mima.setBounds(100, 113, 150, 20);

    this.add(mima);

zhanghao = new JComboBox();

    zhanghao.setEditable(true);

    zhanghao.setBounds(100, 78, 150, 20);

    zhanghao.setFont(new Font("ËÎÌå",Font.PLAIN,13)); this.add(zhanghao);

    guanggao = new JLabel(new ImageIcon("guanggao.gif")); guanggao.setBounds(0, 0, 334, 64);

    beijing = new JLabel(new ImageIcon("beijing.jpg")); beijing.setBounds(0, 64, 334, 154);

    wenzi = new JLabel(new ImageIcon("wenzi.jpg")); wenzi.setBounds(30, 75, 50, 100);

denglu.addActionListener(this);

    // zhanghaowb.addMouseListener(this); // zhanghao.addMouseListener(this); this.add(wenzi);

    this.add(beijing);

    this.setLayout(null);

    this.add(guanggao);

    this.setVisible(true);

    this.setDefaultCloseOperation(3);

    this.setSize(340, 250);

    this.setLocationRelativeTo(null);

    }

    public static void main(String[] args) { /*JFrame.setDefaultLookAndFeelDecorated(true); try {

    UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel()) ;

    UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAn

    dFeel");

} catch (Exception e) {

    System.out.println("Substance Raven Graphite failed to initialize");

    }

    SwingUtilities.invokeLater(new Runnable() { public void run() {

    QQLogin w = new QQLogin();

    w.setVisible(true);

    }

    });*/

    new QQLogin();

    }

    public void mouseClicked(MouseEvent e) { // TODO ×Ô??Éú?É?????æ?ù

}

    public void mouseEntered(MouseEvent e) { if(e.getSource() == dengluzhuangtai) {

    dengluzhuangtai.setIcon(new ImageIcon("zaixianzhuangtaidian.jpg"));

    }

}

    public void mouseExited(MouseEvent e) { if(e.getSource() == dengluzhuangtai) {

    dengluzhuangtai.setIcon(new ImageIcon("zaixianzhuangtai.jpg"));

}

}

    public void mousePressed(MouseEvent e) { // TODO ×Ô??Éú?É?????æ?ù

}

    public void mouseReleased(MouseEvent e) { // TODO ×Ô??Éú?É?????æ?ù

}

    public void mouseDragged(MouseEvent e) { // TODO ×Ô??Éú?É?????æ?ù

}

    public void mouseMoved(MouseEvent e) { // TODO ×Ô??Éú?É?????æ?ù

}

    public class liaotianchuangkou

    {

}

    class SimThread extends Thread{//Ïß?ÌÀà private int current;//?ø?ÈÀ?µÄµ?Ç?Öµ private int target;//?ø?ÈÀ?µÄ×î?óÖµ

public SimThread(int t){

    current=0;

    target=t;

    }

public int getTarget(){

    return target;

    }

public int getCurrent(){

    return current;

    }

public void run(){//Ïß?ÌÌå

    try{

    while (current

    && !interrupted()){//Èç?û?ø?ÈÀ?µÄµ?Ç?ÖµÐ?ÓÚÄ??êÖµ??ÇÒÏß?ÌÃ?ÓÐ??ÖÐ?Ï

    sleep(10);

    current++;

    if(current == 700)

    {

    sleep(3000);

    }

    else if(current == 730)

    {

    sleep(1000);

    }

    }

    }catch (InterruptedException e){} }

}

    public void actionPerformed(ActionEvent e) {

    if(e.getSource() == chashamuma) {

    this.setBounds(300, 300, 340, 300); }

    else if(e.getSource() == denglu) {

    String zh = (String) zhanghao.getSelectedItem();

    System.out.println(zhanghao.getSelectedItem());

    // System.out.println(zhanghao.getItemAt(0));

    char [] str = mima.getPassword(); String mima = String.valueOf(str);; System.out.println(mima);

    // Sql login = new Sql();

// if(login.login(zh,mima))

    // {

    try {

    s = new Socket("127.0.0.1",8888); System.out.println(s);

    PrintWriter pw;

    Scanner sc;

pw = new PrintWriter(s.getOutputStream(),true);

    sc = new Scanner(s.getInputStream()); String str2 = "login#289872400198724#"+zh+"#289872400198724#"+mima;

    System.out.println(str2);

    pw.println(str2);

String str3 = sc.nextLine();

    String yanzheng[] = str3.split("#"); System.out.println(str3);

    if(yanzheng[0].equals("true")) {

    System.out.println("µÇÂ??É??!"); name = yanzheng[1];

    qq = yanzheng[2];

// this.setVisible(false);

// Thread.sleep(5000);

    System.out.println("woao"+name); System.out.println("woai"+qq);

    Logined logined = new Logined(name,qq); this.setVisible(false);

}

    else

    {

    JOptionPane.showMessageDialog(this, "ÓÃ??Ãû?òÃÜÂë?íÎó!", "ÓÃ??Ãû?òÃÜÂë?íÎó!", 0);

    }

    } catch (UnknownHostException e2) { // TODO ×Ô??Éú?É catch ?é

    e2.printStackTrace();

    } catch (IOException e2) {

    // TODO ×Ô??Éú?É catch ?é

    e2.printStackTrace();

    }

/*try {

    login.rs = login.stat.executeQuery("select * from qquser where username='"+zh+"' and

password = '"+mima+"'");

    boolean flag = login.rs.next(); if(flag == true)

    {

    name = login.rs.getString("name"); qq = login.rs.getString("username"); }

    else

    {

}*/

    // } catch (SQLException e1) { // TODO ×Ô??Éú?É catch ?é // e1.printStackTrace();

    // }

}

    else

    {

    JOptionPane.showMessageDialog(this, "ÓÃ??Ãû?òÃÜÂë?íÎó", "ÊäÈë?íÎó", 0);

    }

    // this.setVisible(false); //new Logined();

}

}

Report this document

For any questions or suggestions please email
cust-service@docsford.com